Hey Guys,
I have been trying to understand threading and how to implement it in my engine, I tried a simple example using _beginthread and it worked good, I just had a function that altered a global variable and made multiple threads for it. I also read up on using _beginthreadex for member functions, and it does successfully call my function, but it fails after a bit. I am having trouble understanding this chapter and maybe it's just me not looking at it the right way.
I tried to use a thread to update my physics manager, and I thought, what do I actually use the thread for? Do I initialize my physics manager normally, as well as add my rigid bodies to it normally, but my Update function should be running in a thread? What should run in threads and what shouldn't? Should I only be adding single functions to threads such as the update function of my physics manager? Should my scene synchronization be done seperately? I tried several things and they all had issues
a). In my Physics manager's init function I made a thread that had an infinite loop calling update, I then end the thread in the shutdown
b) I called _beginthreadex every frame (I didn't quite understand threads as much at this point)
What am I doing wrong? I get a ton of errors with anything I try
I have been trying to understand threading and how to implement it in my engine, I tried a simple example using _beginthread and it worked good, I just had a function that altered a global variable and made multiple threads for it. I also read up on using _beginthreadex for member functions, and it does successfully call my function, but it fails after a bit. I am having trouble understanding this chapter and maybe it's just me not looking at it the right way.
I tried to use a thread to update my physics manager, and I thought, what do I actually use the thread for? Do I initialize my physics manager normally, as well as add my rigid bodies to it normally, but my Update function should be running in a thread? What should run in threads and what shouldn't? Should I only be adding single functions to threads such as the update function of my physics manager? Should my scene synchronization be done seperately? I tried several things and they all had issues
a). In my Physics manager's init function I made a thread that had an infinite loop calling update, I then end the thread in the shutdown
b) I called _beginthreadex every frame (I didn't quite understand threads as much at this point)
What am I doing wrong? I get a ton of errors with anything I try
PC - Custom Built
CPU: 3rd Gen. Intel i7 3770 3.4Ghz
GPU: ATI Radeon HD 7959 3GB
RAM: 16GB
Laptop - Alienware M17x
CPU: 3rd Gen. Intel i7 - Ivy Bridge
GPU: NVIDIA GeForce GTX 660M - 2GB GDDR5
RAM: 8GB Dual Channel DDR3 @ 1600mhz
CPU: 3rd Gen. Intel i7 3770 3.4Ghz
GPU: ATI Radeon HD 7959 3GB
RAM: 16GB
Laptop - Alienware M17x
CPU: 3rd Gen. Intel i7 - Ivy Bridge
GPU: NVIDIA GeForce GTX 660M - 2GB GDDR5
RAM: 8GB Dual Channel DDR3 @ 1600mhz