X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=Kernel%2Fthreads.c;h=99a9add67cfd68ec6c69fff2a7377248e9a4effa;hb=2ae2035466cfa7816079a067ccee25e2b8bac6bc;hp=8ec0e9fcdee7b68cd87a6a3d3f7c381e2a9834b2;hpb=7d881c2e5fef91a6570e46ef69a5d4a5cf0e8b4d;p=tpg%2Facess2.git diff --git a/Kernel/threads.c b/Kernel/threads.c index 8ec0e9fc..99a9add6 100644 --- a/Kernel/threads.c +++ b/Kernel/threads.c @@ -840,7 +840,14 @@ void Threads_SegFault(tVAddr Addr) } /** - * \brief heavy mutex + * \brief Acquire a heavy mutex + * \param Mutex Mutex to acquire + * + * This type of mutex checks if the mutex is avaliable, and acquires it + * if it is. Otherwise, the current thread is added to the mutex's wait + * queue and the thread suspends. When the holder of the mutex completes, + * the oldest thread (top thread) on the queue is given the lock and + * restarted. */ void Mutex_Acquire(tMutex *Mutex) { @@ -884,7 +891,8 @@ void Mutex_Acquire(tMutex *Mutex) } /** - * \brief Release a held spinlock + * \brief Release a held mutex + * \param Mutex Mutex to release */ void Mutex_Release(tMutex *Mutex) { @@ -904,6 +912,10 @@ void Mutex_Release(tMutex *Mutex) SHORTREL( &Mutex->Protector ); } +/** + * \brief Is this mutex locked? + * \param Mutex Mutex pointer + */ int Mutex_IsLocked(tMutex *Mutex) { return Mutex->Owner != NULL;