I know why I prefer to stay away from multithreading: it's currently used mechanics are a nightmare in terms of portability. I've already blogged about thinking that a semaphore might solve this problem, but today I realized it doesn't cause it's internally the same as a mutex with some query, build with the same limitations of a normal mutex that you need to do every lock/unlock operation inside the same thread. After further studying of SDL's semaphore implementations, I found that the generic variant actually uses a free combination of semaphores without the typical wait/post loop. However, the mechanic used there would never work for my Linux system cause I know how mutexes behave and that you can't use just them to mimic the effects of semaphores required in this generic implementation. Furthermore, a complete SDL implementation using those "generic" variants is impossible: the generic semaphore implementation requires a mutex and a condition variable implementation where the condition variable implementation requires a mutex and a semaphore implementation! That said, they are only there so provide the same functionlity across all systems as long as they have the required semaphore/condition variable behaviour. System-specific implementations on the other side use only provided system functions with no logic at all. Luckily, I noticed that what I actually need is a condition variable - a way to signal other threads that they continue. I didn't have any lectures about condition variables but I realized that, if it works like described, it must be the exactly problem solution to what I'm looking for. It must be a true nightmare to implement all those different mutex/sem/cond combinations due to all those annoying system differences. Atleast I do know now to NOT rely on system-specific lock/unlock pitfalls but instead rely on that what's defined by standard - not anything else that *might* work somehow.
Man, it's more than annoying. Got to speak with my lecturer about that - I'm sure he'll find it interesting to know that there are exceptions to his practice!