4 * - Mutual Exclusion syncronisation primitive
11 typedef struct sMutex tMutex;
15 tShortSpinlock Protector; //!< Protector for the lock strucure
16 const char *Name; //!< Human-readable name
17 struct sThread *volatile Owner; //!< Owner of the lock (set upon getting the lock)
18 struct sThread *Waiting; //!< Waiting threads
19 struct sThread *LastWaiting; //!< Waiting threads
23 * \brief Acquire a heavy mutex
24 * \param Mutex Mutex to acquire
25 * \return zero on success, -1 if terminated
27 * This type of mutex checks if the mutex is avaliable, and acquires it
28 * if it is. Otherwise, the current thread is added to the mutex's wait
29 * queue and the thread suspends. When the holder of the mutex completes,
30 * the oldest thread (top thread) on the queue is given the lock and
33 extern int Mutex_Acquire(tMutex *Mutex);
36 * \brief Release a held mutex
37 * \param Mutex Mutex to release
38 * \note Releasing a non-held mutex has no effect
40 extern void Mutex_Release(tMutex *Mutex);
43 * \brief Is this mutex locked?
44 * \param Mutex Mutex pointer
46 extern int Mutex_IsLocked(tMutex *Mutex);