libbe_build: Use a copy of the BLocker sources.

My upcoming changes to use our "futexes" instead of semaphores
will obviously not work on non-Haiku platforms, so we now
need a copy of this class in libbe_build.
This commit is contained in:
Augustin Cavalier
2019-07-27 18:33:47 -04:00
parent 3c2901a976
commit 1e8a3588cd
2 changed files with 348 additions and 1 deletions
+50 -1
View File
@@ -1 +1,50 @@
#include <../os/support/Locker.h>
/*
* Copyright 2001-2010 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _LOCKER_H
#define _LOCKER_H
#include <OS.h>
class BLocker {
public:
BLocker();
BLocker(const char* name);
BLocker(bool benaphoreStyle);
BLocker(const char* name, bool benaphoreStyle);
virtual ~BLocker();
status_t InitCheck() const;
bool Lock();
status_t LockWithTimeout(bigtime_t timeout);
void Unlock();
thread_id LockingThread() const;
bool IsLocked() const;
int32 CountLocks() const;
int32 CountLockRequests() const;
sem_id Sem() const;
private:
BLocker(const char* name, bool benaphoreStyle,
bool _ignored);
BLocker(const BLocker&);
BLocker& operator=(const BLocker&);
void InitLocker(const char* name,
bool benaphoreStyle);
bool AcquireLock(bigtime_t timeout, status_t* error);
int32 fBenaphoreCount;
sem_id fSemaphoreID;
thread_id fLockOwner;
int32 fRecursiveCount;
int32 _reserved[4];
};
#endif // _LOCKER_H