mutex for c++
From: Bill Chiu (billchiu_at_despammed.com)
Date: 10/31/03
- Next message: Chris Theis: "Re: Problem using enum with vector?"
- Previous message: Josephine Schafer: "Re: Prime Numbers"
- Next in thread: Victor Bazarov: "Re: mutex for c++"
- Reply: Victor Bazarov: "Re: mutex for c++"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Oct 2003 01:01:37 -0800
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_init(&plock, NULL); }
~Lock() {}
void lock() { pthread_mutex_lock(&plock); }
void unlock() { pthread_mutex_unlock(&plock); }
private:
pthread_mutex_t plock;
};
class testdriver {
testdriver();
private:
Lock testlock;
}
testdriver::testdriver() {
}
p.s. I don't want to use boost lib either.
- Next message: Chris Theis: "Re: Problem using enum with vector?"
- Previous message: Josephine Schafer: "Re: Prime Numbers"
- Next in thread: Victor Bazarov: "Re: mutex for c++"
- Reply: Victor Bazarov: "Re: mutex for c++"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|