X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Finclude%2Frwlock.h;h=8bd374e53dfbc6103eda2c771eb97cafccb64c9e;hb=be5123fe1f4aa66b76ce8ef589362ad21b6bbf72;hp=a6f46b582ef72eec49a19d206357a1e0addd6c43;hpb=be490e1dd003780a02493a51ebbab1a5225c30d1;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/include/rwlock.h b/KernelLand/Kernel/include/rwlock.h index a6f46b58..8bd374e5 100644 --- a/KernelLand/Kernel/include/rwlock.h +++ b/KernelLand/Kernel/include/rwlock.h @@ -25,24 +25,27 @@ struct sRWLock }; /** - * \brief Acquire a heavy mutex - * \param Mutex Mutex to acquire + * \brief Acquire a read-write lock for reading + * \param Lock Lock to acquire * \return zero on success, -1 if terminated * - * 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. + * Waits until the lock is readable and the increments the reader count */ extern int RWLock_AcquireRead(tRWLock *Lock); -extern int RWLock_AcquireWrite(tRWLock *LOck); +/** + * \brief Acquire a read-write lock for writing + * \param Lock Lock to acquire + * \return zero on success, -1 if terminated + * + * Waits until there are no writers, flags all readers to wait, then acquires the lock. + */ +extern int RWLock_AcquireWrite(tRWLock *Lock); /** - * \brief Release a held mutex - * \param Mutex Mutex to release - * \note Releasing a non-held mutex has no effect + * \brief Release a held rw lock + * \param Lock Lock to release + * \note Releasing a non-held lock has no effect */ extern void RWLock_Release(tRWLock *Lock);