Dear C++ Universe,
I wrap pthread lock with a C++ class, and it caused crashes.. Is the
below implementation a real baddy and needs serious spanking??
#include <pthread.h>
class Lock {
public:
Lock() { pthread_mutex_i nit(&plock, NULL); }
~Lock() {}
void lock() { pthread_mutex_l ock(&plock); }
void unlock() { pthread_mutex_u nlock(&plock); }
private:
pthread_mutex_t plock;
};
class testdriver {
testdriver();
private:
Lock testlock;
}
testdriver::tes tdriver() {
}
p.s. I don't want to use boost lib either.
I wrap pthread lock with a C++ class, and it caused crashes.. Is the
below implementation a real baddy and needs serious spanking??
#include <pthread.h>
class Lock {
public:
Lock() { pthread_mutex_i nit(&plock, NULL); }
~Lock() {}
void lock() { pthread_mutex_l ock(&plock); }
void unlock() { pthread_mutex_u nlock(&plock); }
private:
pthread_mutex_t plock;
};
class testdriver {
testdriver();
private:
Lock testlock;
}
testdriver::tes tdriver() {
}
p.s. I don't want to use boost lib either.
Comment