I have the wish for conditions to extent the mutex system. It should be similar to pthread_mutex_t and pthread_cond_t from the c++ header 'pthread.h'.
You can find the complete description here and here.
Up to now we have the functions 'LockMutex()' and 'UnlockMutex()' to synchronize threads. But without conditions we can get trouble with implementing the single-writer-multiple-reader-problem. I thought the following functions were useful:
Code: Select all
hCondition.i = CreateCondition() ;creates a new condition
hMutex.i = CreateMutex()
ConditionWait(hCondition, hMutex) ;release the lock and wait for a signal
ConditionSignal(hCondition) ;signals at least one waiting thread. If no thread is waiting: nop
ConditionSignalAll(hCondition); signals all waiting threads.
You can use conditions for barriers too.
By the way: What's about volatile variables like in C(++)?