diff options
author | Test_User <hax@andrewyu.org> | 2024-10-02 23:31:00 -0400 |
---|---|---|
committer | Test_User <hax@andrewyu.org> | 2024-10-02 23:31:00 -0400 |
commit | be08289b27feacec70aa9c0e006498458e481515 (patch) | |
tree | 823a4ed0c91dbfaed785d8cfcad84d55cc1284d5 | |
parent | Nickname enforcement improvement (diff) | |
download | raxircd-runxiyu.tar.gz raxircd-runxiyu.zip |
-rw-r--r-- | mutex.h | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -99,8 +99,10 @@ inline void mutex_lock(sem_t *mutex) { } inline void mutex_unlock(sem_t *mutex) { - while (sem_trywait(mutex) == -1 && errno == EINTR); - sem_post(mutex); + int available; + sem_getvalue(mutex, &available); + if (available <= 0) + sem_post(mutex); } inline void mutex_destroy(sem_t *mutex) { |