catmutex_init - initialize mutex
#include <cat/cat.h>
#include <cat/catmutex.h>
void catmutex_init(CATMUTEX *m);
This function initializes mutual exclusion lock (mutex) m. This should be done exactly once before the mutex can be used. Use catmutex_free
to free a mutex.
The mutex interface is implemented as macros on top of pthread
mutexes on UNIX or Win32 CriticalSections on Windows NT. It must therefore be assumed that the interface has all the
limitations of any of its possible underlying implementations:
-
Mutexes are non-recursive. If a thread already holding a mutex tries to
lock it again, a deadlock may occur.
-
Mutexes must be released by the thread that locked them.
-
Mutexes are inter-process only.
cat, catutil
catmutex_free