13 static LoggerPtr logger(Logger::getLogger(
"pz.util.semaphore"));
43 if(logger->isDebugEnabled())
45 std::stringstream sout;
47 sout <<
"THREAD IN SEMAPHORE WAIT: " << pthread_self().x <<
" " <<__LINE__ << std::endl;
49 sout <<
"THREAD IN SEMAPHORE WAIT: " << pthread_self() <<
" " <<__LINE__ << std::endl;
51 sout <<
"FCOUNTER VALUE : " <<
fCounter << std::endl;
63 if(logger->isDebugEnabled())
65 std::stringstream sout;
67 sout <<
"THREAD IN SEMAPHORE AFTER WAIT: " << pthread_self().x <<
" " << __LINE__ << std::endl;
69 sout <<
"THREAD IN SEMAPHORE AFTER WAIT: " << pthread_self() <<
" " << __LINE__ << std::endl;
71 sout <<
"FCOUNTER VALUE : " <<
fCounter << std::endl;
87 if(logger->isDebugEnabled())
89 std::stringstream sout;
91 sout <<
"THREAD IN SEMAPHORE POST: " << pthread_self().x <<
" " << __LINE__ << std::endl;
93 sout <<
"THREAD IN SEMAPHORE POST: " << pthread_self() <<
" " << __LINE__ << std::endl;
95 sout <<
"FCOUNTER VALUE : " <<
fCounter << std::endl;
#define PZ_PTHREAD_MUTEX_UNLOCK(mutex, fn)
Contains declaration of the TPZSemaphore class which implements semaphore to threads.
#define PZ_PTHREAD_COND_SIGNAL(cond, fn)
pthread_cond_t fCond
Condition for the thread must to be waiting.
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
#define PZ_PTHREAD_COND_WAIT(cond, mutex, fn)
#define PZ_PTHREAD_COND_INIT(cond, attr, fn)
int fCounter
Counter of the times the semaphore is locked.
#define PZ_PTHREAD_MUTEX_LOCK(mutex, fn)
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
#define PZ_PTHREAD_MUTEX_DESTROY(mutex, fn)
#define PZ_PTHREAD_COND_DESTROY(cond, fn)
~TPZSemaphore(void)
Default destructor.
pthread_mutex_t fMutex
Mutex for the thread.
TPZSemaphore(void)
Default constructor.
#define PZ_PTHREAD_MUTEX_INIT(mutex, attr, fn)