From a62edad69f70d1c86dfa51cc8a2e298bb966180b Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Thu, 11 Jul 2019 23:42:01 +0200 Subject: Document the mutex API, fix spin lock documentation --- kern/mutex.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'kern/mutex.h') diff --git a/kern/mutex.h b/kern/mutex.h index 0e6cd46c..80b7dbdf 100644 --- a/kern/mutex.h +++ b/kern/mutex.h @@ -60,6 +60,9 @@ mutex_locked(const struct mutex *mutex) * This function may not sleep. * * Return 0 on success, EBUSY if the mutex is already locked. + * + * If the operation succeeds, prior unlock operations on the same mutex + * synchronize with this operation. */ static inline int mutex_trylock(struct mutex *mutex) @@ -73,6 +76,9 @@ mutex_trylock(struct mutex *mutex) * On return, the mutex is locked. A mutex can only be locked once. * * This function may sleep. + * + * Prior unlock operations on the same mutex synchronize with this + * operation. */ static inline void mutex_lock(struct mutex *mutex) @@ -89,6 +95,9 @@ mutex_lock(struct mutex *mutex) * A mutex can only be locked once. * * This function may sleep. + * + * Prior unlock operations on the same mutex synchronize with this + * operation. */ static inline int mutex_timedlock(struct mutex *mutex, uint64_t ticks) @@ -101,6 +110,9 @@ mutex_timedlock(struct mutex *mutex, uint64_t ticks) * * The mutex must be locked, and must have been locked by the calling * thread. + * + * This operation synchronizes with subsequent lock operations on the same + * mutex. */ static inline void mutex_unlock(struct mutex *mutex) -- cgit v1.2.3