#include"mutex.h" #include<time.h> Mutex::Mutex() { // pthread_mutexattr_init(&attr); //pthread_mutexattr_setpshared(&attr,PTHREAD_PROCESS_PRIVAITE); // pthread_mutex_init(&lock,NULL); lock = PTHREAD_MUTEX_INITIALIZER; } void Mutex::Lock() { /*struct timespec delta; delta.tv_sec = 5; delta.tv_nsec = 0; pthread_mutex_timedlock_np(&lock,&delta);*/ pthread_mutex_lock(&lock); } void Mutex::Unlock() { pthread_mutex_unlock(&lock); pthread_mutex_destroy(&lock); } Mutex::~Mutex() { }
class LTSC_Manager { public: LTSC_Manager(); virtual ~LTSC_Manager(); IDriver * CreateDriver(char * technology); int RequestNewIdentifier(); int DBConnect(); CDatabaseModule dbConnection; //pthread_mutex_t lock ; Mutex c_section; // here };
m_Manager->c_section.Lock(); int res=m_Manager->m_DB.BookFreeTestHead("AXE",&h); m_Manager->c_section.Unlock(); printf(" res is %i ",res);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)