Changeset 4847 for branches/erijo-dev
- Timestamp:
- 01/30/07 06:44:33 (22 months ago)
- Location:
- branches/erijo-dev/licq
- Files:
-
- 4 modified
-
CMakeLists.txt (modified) (1 diff)
-
src/utils/mutex.cpp (modified) (1 diff)
-
src/utils/mutexlocker.cpp (modified) (1 diff)
-
src/utils/tests/mutexlockertest.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/erijo-dev/licq/CMakeLists.txt
r4835 r4847 9 9 FORCE) 10 10 endif (NOT CMAKE_BUILD_TYPE) 11 12 # Define DEBUG when doing debug builds. 13 set(CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG" CACHE STRING 14 "Flags used by the C++ compiler during debug builds." FORCE) 11 15 12 16 # Enables testing with ctest and adds a "test" target (make test) -
branches/erijo-dev/licq/src/utils/mutex.cpp
r4827 r4847 25 25 : Locked(false) 26 26 { 27 #if defined(DEBUG) && defined(__USE_GNU) 28 pthread_mutexattr_t attr; 29 pthread_mutexattr_init(&attr); 30 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK_NP); 31 pthread_mutex_init(&Mutex, &attr); 32 pthread_mutexattr_destroy(&attr); 33 #else 34 # ifdef DEBUG 35 # warning "Not using error checking mutex since __USE_GNU is not defined." 36 # endif 27 37 pthread_mutex_init(&Mutex, NULL); 38 #endif 28 39 } 29 40 -
branches/erijo-dev/licq/src/utils/mutexlocker.cpp
r4827 r4847 45 45 assert(Mutex != NULL); 46 46 Mutex->unlock(); 47 Locked = true;47 Locked = false; 48 48 } 49 49 -
branches/erijo-dev/licq/src/utils/tests/mutexlockertest.cpp
r4827 r4847 45 45 46 46 BOOST_CHECK_EQUAL(mutex.isLocked(), false); 47 48 // Check that mutex isn't unlocked in locker's destructor when mutex isn't locked. 49 // This test requires that TMutex is built with DEBUG (and __USE_GNU) defined. 50 { 51 TMutexLocker locker(&mutex); 52 locker.lock(); 53 54 BOOST_CHECK_EQUAL(mutex.isLocked(), true); 55 locker.unlock(); 56 BOOST_CHECK_EQUAL(mutex.isLocked(), false); 57 } 58 59 BOOST_CHECK_EQUAL(mutex.isLocked(), false); 47 60 }
