Skip to content

Commit f590514

Browse files
committed
chore(mutex): Update name to match Haiku
Update `mutex_unlock` to `mutex_unblock` to match changes in haiku/haiku@6f3f29c7. The actual fixes have not been applied yet, see #12.
1 parent 2c265cb commit f590514

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

haiku_loader/loader_mutex.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static int32_t atomic_or(int32_t *a, int32_t b);
3434
static int32_t atomic_and(int32_t *a, int32_t b);
3535
static int loader_mutex_lock_locked(int32_t *mutex, const char *name, uint32_t flags, int64_t timeout,
3636
std::unique_lock<std::mutex> &lock);
37-
static void loader_mutex_unlock_locked(int32_t *mutex, uint32_t flags);
37+
static void loader_mutex_unblock_locked(int32_t *mutex, uint32_t flags);
3838
static int loader_mutex_wait_locked(int32_t *mutex, const char *name, uint32_t flags, int64_t timeout,
3939
std::unique_lock<std::mutex> &lock, bool &lastWaiter);
4040
static void add_loader_mutex_info(int32_t *mutex, std::shared_ptr<mutex_info> info);
@@ -60,7 +60,7 @@ int loader_mutex_lock(int32_t *mutex, const char *name, uint32_t flags, int64_t
6060
return error;
6161
}
6262

63-
int loader_mutex_unlock(int32_t *mutex, uint32 flags)
63+
int loader_mutex_unblock(int32_t *mutex, uint32 flags)
6464
{
6565
if (mutex == NULL || ((intptr_t)mutex) % 4 != 0)
6666
{
@@ -70,7 +70,7 @@ int loader_mutex_unlock(int32_t *mutex, uint32 flags)
7070
{
7171
auto lock = std::unique_lock<std::mutex>(sMutexTableLock);
7272

73-
loader_mutex_unlock_locked(mutex, flags);
73+
loader_mutex_unblock_locked(mutex, flags);
7474
}
7575

7676
return B_OK;
@@ -94,7 +94,7 @@ int loader_mutex_switch_lock(int32_t *fromMutex, int32_t *toMutex,
9494
// unlock the first mutex and lock the second one
9595
{
9696
auto lock = std::unique_lock<std::mutex>(sMutexTableLock);
97-
loader_mutex_unlock_locked(fromMutex, flags);
97+
loader_mutex_unblock_locked(fromMutex, flags);
9898

9999
error = loader_mutex_lock_locked(toMutex, name, flags, timeout, lock);
100100
}
@@ -125,7 +125,7 @@ static int loader_mutex_lock_locked(int32_t *mutex, const char *name, uint32_t f
125125
return error;
126126
}
127127

128-
static void loader_mutex_unlock_locked(int32_t *mutex, uint32_t flags)
128+
static void loader_mutex_unblock_locked(int32_t *mutex, uint32_t flags)
129129
{
130130
auto it = sMutexTable.find(mutex);
131131
if (it == sMutexTable.end() || !it->second || it->second->empty())

haiku_loader/loader_mutex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <cstdint>
55

66
int loader_mutex_lock(int32_t* mutex, const char* name, uint32_t flags, int64_t timeout);
7-
int loader_mutex_unlock(int32_t* mutex, uint32_t flags);
7+
int loader_mutex_unblock(int32_t* mutex, uint32_t flags);
88
// Unlocks "from" and locks "to" such that unlocking and starting to wait
99
// for the lock is atomic. I.e. if "from" guards the object "to" belongs
1010
// to, the operation is safe as long as "from" is held while destroying

haiku_loader/sys/linux/loader_commpage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void* loader_allocate_commpage()
103103
hostcalls_ptr->wait_for_thread = loader_wait_for_thread;
104104

105105
hostcalls_ptr->mutex_lock = loader_mutex_lock;
106-
hostcalls_ptr->mutex_unlock = loader_mutex_unlock;
106+
hostcalls_ptr->mutex_unblock = loader_mutex_unblock;
107107
hostcalls_ptr->mutex_switch_lock = loader_mutex_switch_lock;
108108

109109
hostcalls_ptr->realtime_sem_open = loader_realtime_sem_open;

monika/linux/threading.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ status_t _moni_mutex_lock(int32* mutex, const char* name,
111111
return GET_HOSTCALLS()->mutex_lock(mutex, name, flags, timeout);
112112
}
113113

114-
status_t _moni_mutex_unlock(int32* mutex, uint32 flags)
114+
status_t _moni_mutex_unblock(int32* mutex, uint32 flags)
115115
{
116-
return GET_HOSTCALLS()->mutex_unlock(mutex, flags);
116+
return GET_HOSTCALLS()->mutex_unblock(mutex, flags);
117117
}
118118

119119
status_t _moni_mutex_switch_lock(int32* fromMutex, int32* toMutex,

shared_headers/extended_commpage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct hostcalls
6868

6969
// Mutex
7070
int (*mutex_lock)(int32_t* mutex, const char* name, uint32_t flags, int64_t timeout);
71-
int (*mutex_unlock)(int32_t* mutex, uint32_t flags);
71+
int (*mutex_unblock)(int32_t* mutex, uint32_t flags);
7272
int (*mutex_switch_lock)(int32_t* fromMutex, int32_t* toMutex, const char* name, uint32_t flags, int64_t timeout);
7373

7474
// Semaphore

shared_headers/user_mutex_defs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#ifndef _SYSTEM_USER_MUTEX_DEFS_H
66
#define _SYSTEM_USER_MUTEX_DEFS_H
77

8-
// user mutex specific flags passed to _kern_user_mutex_unlock()
8+
// user mutex specific flags passed to _kern_user_mutex_unblock()
99
#define B_USER_MUTEX_UNBLOCK_ALL 0x80000000
1010
// All threads currently waiting on the mutex will be unblocked. The mutex
1111
// state will be locked.

0 commit comments

Comments
 (0)