X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcutil%2Fbeos%2Fsilcbeosmutex.c;h=2e1cef0cb7f6818518b419905b16fea58b6236a0;hb=e7b6c157b80152bf9fb9266e6bdd93f9fb0db776;hp=1c9e113a7f1262a701f90795db545aefe7f21e27;hpb=f93d80a4907e9ddd4bdc8b12a9f82cf2b279d07b;p=silc.git diff --git a/lib/silcutil/beos/silcbeosmutex.c b/lib/silcutil/beos/silcbeosmutex.c index 1c9e113a..2e1cef0c 100644 --- a/lib/silcutil/beos/silcbeosmutex.c +++ b/lib/silcutil/beos/silcbeosmutex.c @@ -19,17 +19,16 @@ /* I used Apache's APR code as a reference here. */ /* $Id$ */ -#include "silcincludes.h" +#include "silc.h" #ifdef SILC_THREADS /* SILC Mutex structure */ struct SilcMutexStruct { - int sema_count; sem_id sema; }; -bool silc_mutex_alloc(SilcMutex *mutex) +SilcBool silc_mutex_alloc(SilcMutex *mutex) { int ret; @@ -43,7 +42,6 @@ bool silc_mutex_alloc(SilcMutex *mutex) return FALSE; } - (*mutex)->sema_count = 0; (*mutex)->sema = ret; return TRUE; @@ -57,18 +55,14 @@ void silc_mutex_free(SilcMutex mutex) void silc_mutex_lock(SilcMutex mutex) { - if (atomic_add(&mutex->sema_count, 1) > 0) { - if (acquire_sem(mutex->sema) < B_NO_ERROR) - assert(FALSE); - } + if (acquire_sem(mutex->sema) < B_NO_ERROR) + assert(FALSE); } void silc_mutex_unlock(SilcMutex mutex) { - if (atomic_add(&mutes->sema_count, -1) > 1) { - if (release_sem(mutex->sema) < B_NO_ERROR) - assert(FALSE); - } + if (release_sem(mutex->sema) < B_NO_ERROR) + assert(FALSE); } #endif /* SILC_THREADS */