Make UEFI boot-platform build again
[haiku.git] / headers / private / shared / PthreadMutexLocker.h
blobdb0e69516fc70c16df24fe7cda234299b93544e3
1 /*
2 * Copyright 2013, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Ingo Weinhold <ingo_weinhold@gmx.de>
7 */
8 #ifndef _PTHREAD_MUTEX_LOCKER_H
9 #define _PTHREAD_MUTEX_LOCKER_H
12 #include <pthread.h>
14 #include <AutoLocker.h>
17 namespace BPrivate {
20 class AutoLockerMutexLocking {
21 public:
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