X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Finclude%2Frwlock.h;h=8bd374e53dfbc6103eda2c771eb97cafccb64c9e;hb=97629e9f86a9cf7162649550b74b112a4fb1765f;hp=e0d4207830e17c25e8de5d65ae7c1f2ae0e2db01;hpb=d0b4559f2936f6d9f06be0f7c3c51527a480ec0d;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/include/rwlock.h b/KernelLand/Kernel/include/rwlock.h index e0d42078..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); +/** + * \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);