@mercuryus: Thanks.

@CoburnDomain: One thread will generally be busier than the other. If it's the main thread, the secondary thread will probably just spend some time waiting for the main thread to be ready, but on a multi-core CPU that's still much better than having it all in one thread. If other threads end up being really busy (busier than the main thread) you'll either have the main thread wait for them (which really removes much of the usefulness of threading), or have the other threads notify the main thread when they're ready.

For example, if for some reason you needed an extremely expensive path-finding algorithm (it's not always about reaching a single position) you'd put it in another thread to avoid a pause whenever a new path is calculated. Each unit that requests a new path will continue what they were doing (or just wait) without pausing the main thread until they are notified by the secondary thread as to when they can move.

Or at least, that's my understanding. You'll still need to be really careful as to how the secondary thread will notify the main thread.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!