#include "UserAPI/DCCDBGlobalMutex.h" #pragma warning(disable: 4996) #include #include using namespace std; using namespace ccdb; //pthread_mutex_t ccdb::DCCDBGlobalMutex::mReadConstsMutex; ///read constants mutex posix // Global static pointer used to ensure a single instance of the class. DCCDBGlobalMutex* ccdb::DCCDBGlobalMutex::mInstance = NULL; //______________________________________________________________________________ DCCDBGlobalMutex* ccdb::DCCDBGlobalMutex::Instance() { /** This function is called to create an instance of the class. Calling the constructor publicly is not allowed. The constructor is private and is only called by this Instance function. */ if (!mInstance) // Only allow one instance of class to be generated. mInstance = new DCCDBGlobalMutex(); return mInstance; } //______________________________________________________________________________ ccdb::DCCDBGlobalMutex::DCCDBGlobalMutex() { int result = pthread_mutex_init(&mReadConstsMutex, NULL); if (result != 0) { fprintf(stderr, "CreateMutex ccdb::DCCDBGlobalMutex::ReadConstsMutex error: %d\n", result); } } //______________________________________________________________________________ void ccdb::DCCDBGlobalMutex::Lock(pthread_mutex_t * mutex) { ///locks mutex by handle posix version pthread_mutex_lock(mutex); } //______________________________________________________________________________ void ccdb::DCCDBGlobalMutex::Release(pthread_mutex_t * mutex) { ///releases mutex by handle posix version cout<<"Release"<