diff options
author | Richard Braun <rbraun@sceen.net> | 2017-08-27 17:20:12 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-08-27 17:20:12 +0200 |
commit | cbf35081fabde1ce35cbaf223fde853db86e06d4 (patch) | |
tree | a6215d6335ec42e33da4b6aadfa1b3c0be9c860b /kern/mutex/mutex_plain_i.h | |
parent | 094319b4a0a04ae11e24b44bb67aaf901536afb2 (diff) | |
parent | 70f7512a01ba8f90aad6dbb4d285e279f0e17e64 (diff) |
Merge branch 'timer_system'
Diffstat (limited to 'kern/mutex/mutex_plain_i.h')
-rw-r--r-- | kern/mutex/mutex_plain_i.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/kern/mutex/mutex_plain_i.h b/kern/mutex/mutex_plain_i.h index 4f112b89..58e565ed 100644 --- a/kern/mutex/mutex_plain_i.h +++ b/kern/mutex/mutex_plain_i.h @@ -24,6 +24,7 @@ #endif #include <assert.h> +#include <stdint.h> #include <kern/atomic.h> #include <kern/error.h> @@ -71,6 +72,7 @@ mutex_plain_unlock_fast(struct mutex *mutex) } void mutex_plain_lock_slow(struct mutex *mutex); +int mutex_plain_timedlock_slow(struct mutex *mutex, uint64_t ticks); void mutex_plain_unlock_slow(struct mutex *mutex); /* @@ -98,6 +100,20 @@ mutex_impl_lock(struct mutex *mutex) } } +static inline int +mutex_impl_timedlock(struct mutex *mutex, uint64_t ticks) +{ + int error; + + error = mutex_plain_lock_fast(mutex); + + if (unlikely(error)) { + error = mutex_plain_timedlock_slow(mutex, ticks); + } + + return error; +} + static inline void mutex_impl_unlock(struct mutex *mutex) { |