Ticket #185: poppler-netlabs-20180813-1429-shl.diff
File poppler-netlabs-20180813-1429-shl.diff, 3.6 KB (added by , 6 years ago) |
---|
-
poppler/GlobalParams.cc
Generated on slamain at 08-13-18 14:29:38 svn diff -x -w
48 48 #define INCL_DOSMODULEMGR 49 49 #define INCL_DOSERRORS 50 50 #include <os2.h> 51 52 #define GLOBAL_PARAMS_CC // Tell GooMutex this is us 53 51 54 #endif 52 55 53 56 #ifdef USE_GCC_PRAGMAS … … 133 136 134 137 GlobalParams *globalParams = NULL; 135 138 139 // 2018-08-13 SHL 140 #if MULTITHREADED 141 #if __OS2__ 142 GooMutex theOS2Mutex; 143 #endif 144 #endif 145 146 136 147 //------------------------------------------------------------------------ 137 148 // PSFontParam16 138 149 //------------------------------------------------------------------------ … … 631 642 gInitMutex(&mutex); 632 643 gInitMutex(&unicodeMapCacheMutex); 633 644 gInitMutex(&cMapCacheMutex); 645 646 #ifdef __OS2__ // 2018-08-13 SHL Single mutux 647 gInitMutex(&theOS2Mutex); 634 648 #endif 649 #endif 635 650 636 651 initBuiltinFontTables(); 637 652 … … 903 918 gDestroyMutex(&mutex); 904 919 gDestroyMutex(&unicodeMapCacheMutex); 905 920 gDestroyMutex(&cMapCacheMutex); 921 922 #ifdef __OS2__ // 2018-08-13 SHL Single mutux 923 gDestroyMutex(&theOS2Mutex); 924 theOS2Mutex = 0; 906 925 #endif 926 #endif 907 927 } 908 928 909 929 //------------------------------------------------------------------------ -
goo/GooMutex.h
54 54 #define gLockMutex(m) EnterCriticalSection(m) 55 55 #define gUnlockMutex(m) LeaveCriticalSection(m) 56 56 57 /* #elif defined(__OS2__) I don't think we still need that 57 #elif defined(__OS2__) 58 58 59 #define INCL_DOS 60 #include <os2.h> 59 /* OS/2 multi-threaded uses pthreads but differs from Linux support 60 in that it uses a single mutex for all protected objects 61 rather than a unique mutex for each object 62 except when invoked for GlobalParams.cc 63 */ 61 64 62 typedef HMTX GooMutex; 65 #include <pthread.h> 63 66 64 #define gInitMutex(m) DosCreateMutexSem(NULL,m,0,FALSE) 65 #define gDestroyMutex(m) DosCloseMutexSem(*m) 66 #define gLockMutex(m) DosRequestMutexSem(*m,SEM_INDEFINITE_WAIT) 67 #define gUnlockMutex(m) DosReleaseMutexSem(*m) 67 typedef pthread_mutex_t GooMutex2; 68 69 #ifdef GLOBAL_PARAMS_CC 70 71 typedef pthread_mutex_t GooMutex; 72 73 // Keep in sync with Linux style mutexes 74 75 inline void gInitMutex(GooMutex *m) { 76 pthread_mutexattr_t mutexattr; 77 pthread_mutexattr_init(&mutexattr); 78 pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE); 79 pthread_mutex_init(m, &mutexattr); 80 pthread_mutexattr_destroy(&mutexattr); 81 } 82 83 #define gDestroyMutex(m) pthread_mutex_destroy(m) 84 85 #define gLockMutex(m) pthread_mutex_lock(m) 86 #define gUnlockMutex(m) pthread_mutex_unlock(m) 87 88 #else 89 90 /* Use single mutex everywhere other than GlobalParams.cc. 91 This avoids OS/2 running out of semaphores when documents 92 require a large number of class instances. 93 All classes other than those defined in GlobalParams.cc will 94 use the same mutex (theOS2Mutex). 95 GooMutex is typedef'ed as a pointer so macro users will pass 96 a pointer to a pointer. 97 The macros dereference this pointer and pass a pointer to apthread_mutex 98 to the pthreads functions. 99 2018-08-13 SHL 68 100 */ 101 102 class MutexLocker; 103 typedef pthread_mutex_t *GooMutex; 104 105 inline void gInitMutex(GooMutex *m) { 106 extern GooMutex2 theOS2Mutex; 107 *(m) = &theOS2Mutex; 108 } 109 #define gDestroyMutex(m) // Do nothing 110 111 #define gLockMutex(m) pthread_mutex_lock(*(m)) 112 #define gUnlockMutex(m) pthread_mutex_unlock(*(m)) 113 114 #endif // __OS2__ 115 69 116 #else // assume pthreads 70 117 71 118 #include <pthread.h>