[Cppunit-cvs] cppunit2/include/cpptl atomiccounter.h,1.8,1.9 config.h,1.20,1.21
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2005-11-09 22:04:07
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24863/include/cpptl Modified Files: atomiccounter.h config.h Log Message: - removed support for atomic counter on linux (warning on include, don't work reliably) Index: config.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/config.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** config.h 6 Sep 2005 07:14:49 -0000 1.20 --- config.h 9 Nov 2005 22:03:56 -0000 1.21 *************** *** 71,75 **** # elif defined(linux) || defined(__linux) || defined(__linux__) # define CPPTL_USE_PTHREAD_THREAD 1 - # define CPPTL_USE_LINUX_ATOMIC 1 # elif defined(sun) || defined(__sun) # define CPPTL_USE_PTHREAD_THREAD 1 --- 71,74 ---- *************** *** 138,145 **** # if !CPPTL_HAS_THREAD_SAFE_ATOMIC_COUNTER ! # if CPPTL_USE_PTHREAD_THREAD && !CPPTL_USE_WIN32_ATOMIC && !CPPTL_USE_LINUX_ATOMIC # define CPPTL_USE_PTHREAD_ATOMIC 1 # endif ! # if CPPTL_USE_PTHREAD_ATOMIC || CPPTL_USE_WIN32_ATOMIC || CPPTL_USE_LINUX_ATOMIC # define CPPTL_HAS_THREAD_SAFE_ATOMIC_COUNTER 1 # endif --- 137,144 ---- # if !CPPTL_HAS_THREAD_SAFE_ATOMIC_COUNTER ! # if CPPTL_USE_PTHREAD_THREAD && !CPPTL_USE_WIN32_ATOMIC # define CPPTL_USE_PTHREAD_ATOMIC 1 # endif ! # if CPPTL_USE_PTHREAD_ATOMIC || CPPTL_USE_WIN32_ATOMIC # define CPPTL_HAS_THREAD_SAFE_ATOMIC_COUNTER 1 # endif Index: atomiccounter.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/atomiccounter.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** atomiccounter.h 7 Mar 2005 21:34:44 -0000 1.8 --- atomiccounter.h 9 Nov 2005 22:03:55 -0000 1.9 *************** *** 3,9 **** # include <cpptl/config.h> ! # if CPPTL_USE_LINUX_ATOMIC ! # include <asm/atomic.h> ! # elif CPPTL_USE_PTHREAD_ATOMIC # include <pthread.h> # endif --- 3,7 ---- # include <cpptl/config.h> ! # if CPPTL_USE_PTHREAD_ATOMIC # include <pthread.h> # endif *************** *** 116,157 **** }; - // ////////////////////////////////////////////////////////////////// - // ////////////////////////////////////////////////////////////////// - // AtomicCounter implementation for Linux - // ////////////////////////////////////////////////////////////////// - // ////////////////////////////////////////////////////////////////// - #elif CPPTL_USE_LINUX_ATOMIC - - - class CPPTL_API AtomicCounter : public NonCopyable - { - public: - AtomicCounter( long count = 0 ) - { - atomic_t value = ATOMIC_INIT(count); - count_ = value; - } - - - void increment() - { - atomic_inc( &count_ ); - } - - - bool decrement() - { - return !atomic_dec_and_test( &count_ ); - } - - - long count() const - { - return atomic_read( &count_ ); - } - - private: - atomic_t count_; - }; --- 114,117 ---- |