- Timestamp:
- Mar 4, 2010, 7:39:52 PM (15 years ago)
- Location:
- trunk/src/3rdparty/clucene/src/CLucene
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/3rdparty/clucene/src/CLucene/LuceneThreads.h
r2 r630 45 45 #endif 46 46 #include "CLucene/config/threadCSection.h" 47 #elif defined(_CL_HAVE_OS2_THREADS) || defined(__OS2__) 48 #if !defined(_CL_HAVE_OS2_THREADS) 49 #define _CL_HAVE_OS2_THREADS 50 #endif 51 #include "CLucene/config/threadOS2.h" 47 52 #else 48 53 #error A valid thread library was not found -
trunk/src/3rdparty/clucene/src/CLucene/config/compiler.h
r2 r630 80 80 #define _WIN32 81 81 #include "CLucene/config/PlatformWin32.h" 82 83 #elif defined (__OS2__) 84 #undef _OS2 85 #define _OS2 86 #include "CLucene/config/PlatformOS2.h" 82 87 83 88 #elif defined (__WIN16) || defined (WIN16) || defined (_WIN16) -
trunk/src/3rdparty/clucene/src/CLucene/config/threads.cpp
r2 r630 48 48 extern "C" __declspec(dllimport) unsigned long __stdcall GetCurrentThreadId(); 49 49 #endif 50 50 51 51 mutex_win32::mutex_win32(const mutex_win32& clone){ 52 InitializeCriticalSection(&mtx); 52 InitializeCriticalSection(&mtx); 53 53 } 54 54 mutex_win32::mutex_win32() 55 { 56 InitializeCriticalSection(&mtx); 55 { 56 InitializeCriticalSection(&mtx); 57 57 } 58 58 59 59 mutex_win32::~mutex_win32() 60 { 61 DeleteCriticalSection(&mtx); 60 { 61 DeleteCriticalSection(&mtx); 62 62 } 63 63 64 64 void mutex_win32::lock() 65 { 66 EnterCriticalSection(&mtx); 65 { 66 EnterCriticalSection(&mtx); 67 67 } 68 68 69 69 void mutex_win32::unlock() 70 { 71 LeaveCriticalSection(&mtx); 70 { 71 LeaveCriticalSection(&mtx); 72 72 } 73 73 … … 76 76 #elif defined(_CL_HAVE_PTHREAD) 77 77 #include "CLucene/config/threadPthread.h" 78 78 79 79 #ifdef _CL_HAVE_PTHREAD_MUTEX_RECURSIVE 80 80 bool mutex_pthread_attr_initd=false; 81 81 pthread_mutexattr_t mutex_pthread_attr; 82 82 #endif 83 83 84 84 #ifdef _CL__CND_DEBUG 85 85 #define _CLPTHREAD_CHECK(c,m) CND_PRECONDITION(c==0,m) … … 92 92 _CLPTHREAD_CHECK(pthread_mutex_init(&mtx, &mutex_pthread_attr), "mutex_pthread(clone) constructor failed") 93 93 #else 94 94 #if defined(__hpux) && defined(_DECTHREADS_) 95 95 _CLPTHREAD_CHECK(pthread_mutex_init(&mtx, pthread_mutexattr_default), "mutex_pthread(clone) constructor failed") 96 96 #else … … 102 102 } 103 103 mutex_pthread::mutex_pthread() 104 { 104 { 105 105 #ifdef _CL_HAVE_PTHREAD_MUTEX_RECURSIVE 106 107 108 109 106 if ( mutex_pthread_attr_initd == false ){ 107 pthread_mutexattr_init(&mutex_pthread_attr); 108 pthread_mutexattr_settype(&mutex_pthread_attr, PTHREAD_MUTEX_RECURSIVE); 109 mutex_pthread_attr_initd = true; 110 110 } 111 111 _CLPTHREAD_CHECK(pthread_mutex_init(&mtx, &mutex_pthread_attr), "mutex_pthread(clone) constructor failed") … … 141 141 #endif 142 142 } 143 143 144 144 void mutex_pthread::unlock() 145 { 145 { 146 146 #ifndef _CL_HAVE_PTHREAD_MUTEX_RECURSIVE 147 147 --lockCount; … … 156 156 } 157 157 158 #elif defined(_CL_HAVE_OS2_THREADS) 159 #include "CLucene/config/threadOS2.h" 160 161 mutex_os2::mutex_os2(const mutex_os2& clone) 162 { 163 DosCreateMutexSem(NULL, &mtx, 0, FALSE); 164 } 165 166 mutex_os2::mutex_os2() 167 { 168 DosCreateMutexSem(NULL, &mtx, 0, FALSE); 169 } 170 171 mutex_os2::~mutex_os2() 172 { 173 DosCloseMutexSem(mtx); 174 } 175 176 void mutex_os2::lock() 177 { 178 DosRequestMutexSem(mtx, SEM_INDEFINITE_WAIT); 179 } 180 181 void mutex_os2::unlock() 182 { 183 DosReleaseMutexSem(mtx); 184 } 185 186 ULONG mutex_os2::getCurrentTid(void) 187 { 188 PTIB pTIB; 189 return (DosGetInfoBlocks(&pTIB, NULL) == 0) ? 190 pTIB->tib_ptib2->tib2_ultid : 1; 191 } 192 158 193 #endif //thread impl choice 159 194
Note:
See TracChangeset
for help on using the changeset viewer.