CL_Mutex3
Mutex interface.
Overview
If you don't know what a mutex is, read a book. :-)
Class members
- static CL_Mutex *
create()
- virtual
~CL_Mutex()
- virtual void
enter()
- virtual void
leave()
- virtual void
wait()
- virtual void
notify()
- virtual void
notify_all()
Members with descriptions
- static CL_Mutex *
create() -
Description:
Call this to create a mutex.
- virtual
~CL_Mutex() -
Description:
- virtual void
enter() -
Description:
Enter the critical section.
- virtual void
leave() -
Description:
Leave the critical section.
- virtual void
wait() -
Description:
wait releases the mutex this thread has taken out and sends the thread to sleep. Other threads can then acquire the mutex and modify any data. When another thread calls notify, the thread that called wait will wake up again and automatically reacquire the mutex.
Warning: This function must not be called on an unlocked mutex. You must call enter first.
Warning: When wait returns (after another thread has called notify/notifyAll, the current thread will have a mutex lock. Be sure to call leave at some point.
Warning: Not implemented under Win32. If you need it, please implement it in Sources/Core/System/Win32/mutex_win32.*, and send me the patch. :-)
- virtual void
notify() -
Description:
Notify wakes up the first thread that has gone to sleep on this mutex in order to wait for a notification. For safety reasons, you are advised to acquire the mutex using 'enter' before calling notify. (Of course you have to release the mutex using 'leave' after notifying, otherwise the waiting thread cannot reacquire it).
Warning: Not implemented under Win32. If you need it, please implement it in Sources/Core/System/Win32/mutex_win32.*, and send me the patch. :-)
- virtual void
notify_all() -
Description:
NotifyAll wakes up all threads waiting on the mutex. Warning: Not implemented under Win32. If you need it, please implement it in Sources/Core/System/Win32/mutex_win32.*, and send me the patch. :-)