Reference

CL_Mutex(3)

Mutex interface.

NAME

CL_Mutex - Mutex interface.

DESCRIPTION

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. :-)

SEE ALSO

All ClanLib API classes can be found in clanlib (3).

AUTHORS

Originally written by Magnus Norddahl <[email protected]> and Martin Starch <[email protected]>. ClanLib is now developed by the ClanLib Development team as an Open Source project.

The ClanLib man pages was created using the Perceps documentation system (another excellent piece of Open Source software, available at http://somewhere.in.the.world.org).

See clanlib (3) to find out how to get a full list of contributors and details on how to submit bug reports, comments etc.