}
BMutex::BMutex(const BMutex& mutex){
pthread_mutex_init(&omutex, 0);
}
BMutex& BMutex::operator=(const BMutex& mutex){
return *this;
}
BMutex::~BMutex(){
pthread_mutex_destroy(&omutex);
}
#if MDEBUG
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <linux/unistd.h>
#include <errno.h>
static pid_t gettid(){
return syscall(__NR_gettid);
}
int BMutex::lock(){
int e;
printf("BMutex::lock: %p Thread: %u\n", this, gettid());
e = pthread_mutex_lock(&omutex);
printf("BMutex::lock: %p: Thread: %u: Acquired\n", this, gettid());
return e;
}