BTokenSpace: Use pthread_mutex instead of BLocker.

This header gets included in the build platform, so we can't use
the private recursive_lock.

Eliminates another statically created BLocker, due to gDefaultTokens.
This commit is contained in:
Augustin Cavalier
2026-03-02 20:16:32 -05:00
parent f9850b561c
commit 5eef2f1d00
4 changed files with 16 additions and 23 deletions
+4 -4
View File
@@ -13,7 +13,6 @@
#include <map>
#include <stack>
#include <Locker.h>
#include <SupportDefs.h>
@@ -33,11 +32,13 @@ namespace BPrivate {
class BDirectMessageTarget;
class BTokenSpace : public BLocker {
class BTokenSpace {
public:
BTokenSpace();
~BTokenSpace();
pthread_mutex_t* GetLock() { return &fLock; }
int32 NewToken(int16 type, void* object);
bool SetToken(int32 token, int16 type, void* object);
@@ -51,8 +52,6 @@ public:
status_t AcquireHandlerTarget(int32 token,
BDirectMessageTarget** _target);
void InitAfterFork();
private:
struct token_info {
int16 type;
@@ -61,6 +60,7 @@ private:
};
typedef std::map<int32, token_info> TokenMap;
mutable pthread_mutex_t fLock;
TokenMap fTokenMap;
int32 fNextToken;
};