diff --git a/headers/private/kernel/util/AutoLock.h b/headers/private/kernel/util/AutoLock.h index 9a2639e52a..c05b22e3f8 100644 --- a/headers/private/kernel/util/AutoLock.h +++ b/headers/private/kernel/util/AutoLock.h @@ -35,6 +35,22 @@ public: typedef AutoLocker MutexLocker; +class MutexTryLocking { +public: + inline bool Lock(mutex *lockable) + { + return mutex_trylock(lockable) == B_OK; + } + + inline void Unlock(mutex *lockable) + { + mutex_unlock(lockable); + } +}; + +typedef AutoLocker MutexTryLocker; + + class RecursiveLockLocking { public: inline bool Lock(recursive_lock *lockable) @@ -301,6 +317,7 @@ typedef AutoLocker using BPrivate::AutoLocker; using BPrivate::MutexLocker; +using BPrivate::MutexTryLocker; using BPrivate::RecursiveLocker; using BPrivate::ReadLocker; using BPrivate::WriteLocker;