2 * Copyright 2013, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 * Ingo Weinhold <ingo_weinhold@gmx.de>
8 #ifndef _PTHREAD_MUTEX_LOCKER_H
9 #define _PTHREAD_MUTEX_LOCKER_H
14 #include <AutoLocker.h>
20 class AutoLockerMutexLocking
{
22 inline bool Lock(pthread_mutex_t
* lockable
)
24 return pthread_mutex_lock(lockable
) == 0;
27 inline void Unlock(pthread_mutex_t
* lockable
)
29 pthread_mutex_unlock(lockable
);
34 typedef AutoLocker
<pthread_mutex_t
, AutoLockerMutexLocking
> PthreadMutexLocker
;
37 } // namespace BPrivate
39 using BPrivate::PthreadMutexLocker
;
42 #endif // _PTHREAD_MUTEX_LOCKER_H