diff options
-rw-r--r-- | kern/mutex.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/kern/mutex.h b/kern/mutex.h index f192a70a..8cb7aaca 100644 --- a/kern/mutex.h +++ b/kern/mutex.h @@ -27,6 +27,8 @@ #error "only one of X15_MUTEX_PI and X15_MUTEX_ADAPTIVE may be defined" #endif +#include <stdint.h> + #if defined(X15_MUTEX_PI) #include <kern/mutex/mutex_pi_i.h> #elif defined(X15_MUTEX_ADAPTIVE) @@ -77,6 +79,22 @@ mutex_lock(struct mutex *mutex) } /* + * Lock a mutex, with a time boundary. + * + * The time boundary is an absolute time in ticks. + * + * If successful, the mutex is locked, otherwise an error is returned. + * A mutex can only be locked once. + * + * This function may sleep. + */ +static inline int +mutex_timedlock(struct mutex *mutex, uint64_t ticks) +{ + return mutex_impl_timedlock(mutex, ticks); +} + +/* * Unlock a mutex. * * The mutex must be locked, and must have been locked by the calling |