I'm just wondering exactly what factors affect how quickly createthread executes, and how long it has to live to make it "worth it".
CONTEXT: Where in my game's loops should I spawn threads?
I'm just wondering exactly what factors affect how quickly createthread executes, and how long it has to live to make it "worth it".
CONTEXT: Where in my game's loops should I spawn threads?
The main game loop is not the place to spawn worker threads. The main game loop should be as free of clutter as possible. Worker threads should be spawned during program startup and then used as need by the main game loop. Look into thread pooling techniques.
I agree in general with the preceding answers. I'd add a note about Windows' CreateThread. It has in general to allocate some stack, so we must take into account the overhead due to some kind of dynamic memory allocation in user space.
Regards