08-11-2007, 08:15 PM
I didn't say threads are bad, I just was stating that spawning a thread for something that doesn't need a thread is bad. In this scenario, there is:
- A global game loop
- One event being raised from the thread before its destroyed
- No heavy importance of time (you can afford waiting a frame)
All of these point to single-threading. Just because you can use multithreading, doesn't mean you should. Multithreading is only faster if theres blocking operations being called (file I/O or socket I/O namely). Besides that, it is always slower than the single-threaded alternative, it just appears faster because they are in sync. The CPU has to take extra time to sort the threads and find which one needs to be updated.
- A global game loop
- One event being raised from the thread before its destroyed
- No heavy importance of time (you can afford waiting a frame)
All of these point to single-threading. Just because you can use multithreading, doesn't mean you should. Multithreading is only faster if theres blocking operations being called (file I/O or socket I/O namely). Besides that, it is always slower than the single-threaded alternative, it just appears faster because they are in sync. The CPU has to take extra time to sort the threads and find which one needs to be updated.