#include <stdio.h>
#include <errno.h>
-#ifndef NO_GUICAST
#include "bcsignals.h"
-#endif
#include "mutex.h"
Mutex::Mutex(const char *title, int recursive)
{
this->title = title;
+ this->trace = 0;
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutex_init(&mutex, &attr);
{
pthread_mutex_destroy(&mutex);
pthread_mutex_destroy(&recursive_lock);
-#ifndef NO_GUICAST
UNSET_ALL_LOCKS(this);
-#endif
}
int Mutex::lock(const char *location)
}
-#ifndef NO_GUICAST
SET_LOCK(this, title, location);
-#endif
if(pthread_mutex_lock(&mutex)) perror("Mutex::lock");
}
-#ifndef NO_GUICAST
SET_LOCK2
-#endif
return 0;
}
count = 0;
-#ifndef NO_GUICAST
UNSET_LOCK(this);
-#endif
if(pthread_mutex_unlock(&mutex)) perror("Mutex::unlock");
return 0;
else
count = 1;
-#ifndef NO_GUICAST
SET_LOCK(this, title, location);
SET_LOCK2
-#endif
return 0;
}
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutex_init(&mutex, &attr);
+ UNSET_ALL_LOCKS(this)
+ trace = 0;
count = 0;
thread_id = 0;
thread_id_valid = 0;
-#ifndef NO_GUICAST
- UNSET_ALL_LOCKS(this)
-#endif
return 0;
}