SIEGE has just (well, actually a few days ago) received new functionality, all related to threading. The following are now available:
- threads (suprise, suprise!)
- thread-local storage
- mutexes
- semaphores
The API is cross-platform – it works both in Windows and on POSIX systems. I won’t be quoting all the functions added here because there is quite a lot of those – if you want to see all of them, check out these files: /include/siege/util/thread.h, /include/siege/util/threadkey.h, /include/siege/util/mutex.h and /include/siege/util/semaphore.h.
As you may know, SIEGE does not actually use threads – yet, so what do I need this API for? Well, I’m working on getting a separate rendering thread running in SIEGE (optional, controlled by a flag, so you don’t have to worry about thread-safety if you don’t want to and instead disable multithreading). Furthermore, I want to eventually make SIEGE completely event-based (again, controlled by flags) so that event handlers can run from a thread pool and use messages for communication.