projects
/
silc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added SILC Server library.
[silc.git]
/
lib
/
silcutil
/
unix
/
silcunixmutex.c
diff --git
a/lib/silcutil/unix/silcunixmutex.c
b/lib/silcutil/unix/silcunixmutex.c
index f368116547d8e873e1799ceebb1a27ef4484ee92..0eae1496ce99ae6162ddb91e6896e1959eec045d 100644
(file)
--- a/
lib/silcutil/unix/silcunixmutex.c
+++ b/
lib/silcutil/unix/silcunixmutex.c
@@
-18,13
+18,12
@@
*/
/* $Id$ */
*/
/* $Id$ */
-#include "silc
includes
.h"
+#include "silc.h"
/* SILC Mutex structure */
struct SilcMutexStruct {
#ifdef SILC_THREADS
pthread_mutex_t mutex;
/* SILC Mutex structure */
struct SilcMutexStruct {
#ifdef SILC_THREADS
pthread_mutex_t mutex;
- unsigned int locked : 1;
#else
void *tmp;
#endif /* SILC_THREADS */
#else
void *tmp;
#endif /* SILC_THREADS */
@@
-37,8
+36,10
@@
SilcBool silc_mutex_alloc(SilcMutex *mutex)
if (*mutex == NULL)
return FALSE;
pthread_mutex_init(&(*mutex)->mutex, NULL);
if (*mutex == NULL)
return FALSE;
pthread_mutex_init(&(*mutex)->mutex, NULL);
-#endif /* SILC_THREADS */
return TRUE;
return TRUE;
+#else
+ return FALSE;
+#endif /* SILC_THREADS */
}
void silc_mutex_free(SilcMutex mutex)
}
void silc_mutex_free(SilcMutex mutex)
@@
-57,8
+58,6
@@
void silc_mutex_lock(SilcMutex mutex)
if (mutex) {
if (pthread_mutex_lock(&mutex->mutex))
assert(FALSE);
if (mutex) {
if (pthread_mutex_lock(&mutex->mutex))
assert(FALSE);
- assert(mutex->locked == 0);
- mutex->locked = 1;
}
#endif /* SILC_THREADS */
}
}
#endif /* SILC_THREADS */
}
@@
-67,8
+66,6
@@
void silc_mutex_unlock(SilcMutex mutex)
{
#ifdef SILC_THREADS
if (mutex) {
{
#ifdef SILC_THREADS
if (mutex) {
- assert(mutex->locked == 1);
- mutex->locked = 0;
if (pthread_mutex_unlock(&mutex->mutex))
assert(FALSE);
}
if (pthread_mutex_unlock(&mutex->mutex))
assert(FALSE);
}