Changeset 630 for trunk/src


Ignore:
Timestamp:
Mar 4, 2010, 7:39:52 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

3rdparty/clucene: Added OS/2 support [patch by rudi].

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  
    4545                #endif
    4646                #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"
    4752        #else
    4853                #error A valid thread library was not found
  • trunk/src/3rdparty/clucene/src/CLucene/config/compiler.h

    r2 r630  
    8080#define _WIN32
    8181#include "CLucene/config/PlatformWin32.h"
     82
     83#elif defined (__OS2__)
     84#undef _OS2
     85#define _OS2
     86#include "CLucene/config/PlatformOS2.h"
    8287
    8388#elif defined (__WIN16) || defined (WIN16) || defined (_WIN16)
  • trunk/src/3rdparty/clucene/src/CLucene/config/threads.cpp

    r2 r630  
    4848          extern "C" __declspec(dllimport) unsigned long __stdcall GetCurrentThreadId();
    4949   #endif
    50        
     50
    5151        mutex_win32::mutex_win32(const mutex_win32& clone){
    52                 InitializeCriticalSection(&mtx); 
     52                InitializeCriticalSection(&mtx);
    5353        }
    5454        mutex_win32::mutex_win32()
    55         { 
    56                 InitializeCriticalSection(&mtx); 
     55        {
     56                InitializeCriticalSection(&mtx);
    5757        }
    58        
     58
    5959        mutex_win32::~mutex_win32()
    60         { 
    61                 DeleteCriticalSection(&mtx); 
     60        {
     61                DeleteCriticalSection(&mtx);
    6262        }
    63        
     63
    6464        void mutex_win32::lock()
    65         { 
    66                 EnterCriticalSection(&mtx); 
     65        {
     66                EnterCriticalSection(&mtx);
    6767        }
    68        
     68
    6969        void mutex_win32::unlock()
    70         { 
    71                 LeaveCriticalSection(&mtx); 
     70        {
     71                LeaveCriticalSection(&mtx);
    7272        }
    7373
     
    7676#elif defined(_CL_HAVE_PTHREAD)
    7777        #include "CLucene/config/threadPthread.h"
    78                
     78
    7979        #ifdef _CL_HAVE_PTHREAD_MUTEX_RECURSIVE
    8080                bool mutex_pthread_attr_initd=false;
    8181                pthread_mutexattr_t mutex_pthread_attr;
    8282        #endif
    83        
     83
    8484        #ifdef _CL__CND_DEBUG
    8585                #define _CLPTHREAD_CHECK(c,m) CND_PRECONDITION(c==0,m)
     
    9292                _CLPTHREAD_CHECK(pthread_mutex_init(&mtx, &mutex_pthread_attr), "mutex_pthread(clone) constructor failed")
    9393                #else
    94                 #if defined(__hpux) && defined(_DECTHREADS_)
     94                #if defined(__hpux) && defined(_DECTHREADS_)
    9595                        _CLPTHREAD_CHECK(pthread_mutex_init(&mtx, pthread_mutexattr_default), "mutex_pthread(clone) constructor failed")
    9696                #else
     
    102102        }
    103103        mutex_pthread::mutex_pthread()
    104         { 
     104        {
    105105                #ifdef _CL_HAVE_PTHREAD_MUTEX_RECURSIVE
    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;
     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;
    110110                }
    111111                _CLPTHREAD_CHECK(pthread_mutex_init(&mtx, &mutex_pthread_attr), "mutex_pthread(clone) constructor failed")
     
    141141                #endif
    142142        }
    143        
     143
    144144        void mutex_pthread::unlock()
    145         { 
     145        {
    146146                #ifndef _CL_HAVE_PTHREAD_MUTEX_RECURSIVE
    147147                --lockCount;
     
    156156        }
    157157
     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
    158193#endif //thread impl choice
    159194
Note: See TracChangeset for help on using the changeset viewer.