00001
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00032
00033 #ifndef GROOVX_RUTZ_SPIN_LOCK_PTHREADS_CC_UTC20070905192104_DEFINED
00034 #define GROOVX_RUTZ_SPIN_LOCK_PTHREADS_CC_UTC20070905192104_DEFINED
00035
00036 #ifdef HAVE_PTHREAD_SPINLOCK_T
00037
00038 #include "rutz/spin_lock_pthreads.h"
00039
00040 #include "rutz/sfmt.h"
00041
00042 #include <string.h>
00043
00044 rutz::spin_lock_pthreads::spin_lock_pthreads()
00045 {
00046 const int c = pthread_spin_init(&m_lock, 0);
00047 if (c != 0)
00048 {
00049 char buf[256];
00050 strerror_r(c, &buf[0], sizeof(buf));
00051 buf[sizeof(buf)-1] = '\0';
00052 throw rutz::error(rutz::sfmt("pthread_spin_init() failed (%s)",
00053 &buf[0]),
00054 SRC_POS);
00055 }
00056 }
00057
00058 rutz::spin_lock_pthreads::~spin_lock_pthreads()
00059 {
00060 pthread_spin_destroy(&m_lock);
00061 }
00062
00063 #endif // HAVE_PTHREAD_SPINLOCK_T
00064
00065 static const char vcid_groovx_rutz_spin_lock_pthreads_cc_utc20070905192104[] = "$Id: spin_lock_pthreads.cc 10134 2008-03-04 17:58:05Z rjpeters $ $HeadURL: file:///lab/rjpeters/svnrepo/code/trunk/groovx/src/rutz/spin_lock_pthreads.cc $";
00066 #endif // !GROOVX_RUTZ_SPIN_LOCK_PTHREADS_CC_UTC20070905192104DEFINED