31 #ifndef _CPL_MULTIPROC_H_INCLUDED_ 32 #define _CPL_MULTIPROC_H_INCLUDED_ 43 #if defined(WIN32) && !defined(CPL_MULTIPROC_STUB) 44 # define CPL_MULTIPROC_WIN32 47 # undef CPL_MULTIPROC_PTHREAD 50 #if !defined(CPL_MULTIPROC_WIN32) && !defined(CPL_MULTIPROC_PTHREAD) \ 51 && !defined(CPL_MULTIPROC_STUB) && !defined(CPL_MULTIPROC_NONE) 52 # define CPL_MULTIPROC_STUB 57 typedef void (*CPLThreadFunc)(
void *);
59 void CPL_DLL *CPLLockFile(
const char *pszPath,
double dfWaitInSeconds );
60 void CPL_DLL CPLUnlockFile(
void *hLock );
63 typedef struct _CPLMutex CPLMutex;
64 typedef struct _CPLCond CPLCond;
65 typedef struct _CPLJoinableThread CPLJoinableThread;
69 #define CPLJoinableThread void 73 #define CPL_MUTEX_RECURSIVE 0 74 #define CPL_MUTEX_ADAPTIVE 1 76 CPLMutex CPL_DLL *CPLCreateMutex(
void );
77 CPLMutex CPL_DLL *CPLCreateMutexEx(
int nOptions );
78 int CPL_DLL CPLCreateOrAcquireMutex( CPLMutex **,
double dfWaitInSeconds );
79 int CPL_DLL CPLCreateOrAcquireMutexEx( CPLMutex **,
double dfWaitInSeconds,
int nOptions );
80 int CPL_DLL CPLAcquireMutex( CPLMutex *hMutex,
double dfWaitInSeconds );
81 void CPL_DLL CPLReleaseMutex( CPLMutex *hMutex );
82 void CPL_DLL CPLDestroyMutex( CPLMutex *hMutex );
83 void CPL_DLL CPLCleanupMasterMutex(
void );
85 CPLCond CPL_DLL *CPLCreateCond(
void );
86 void CPL_DLL CPLCondWait( CPLCond *hCond, CPLMutex* hMutex );
87 void CPL_DLL CPLCondSignal( CPLCond *hCond );
88 void CPL_DLL CPLCondBroadcast( CPLCond *hCond );
89 void CPL_DLL CPLDestroyCond( CPLCond *hCond );
91 GIntBig CPL_DLL CPLGetPID(
void );
92 int CPL_DLL CPLCreateThread( CPLThreadFunc pfnMain,
void *pArg );
93 CPLJoinableThread CPL_DLL* CPLCreateJoinableThread( CPLThreadFunc pfnMain,
void *pArg );
94 void CPL_DLL CPLJoinThread(CPLJoinableThread* hJoinableThread);
95 void CPL_DLL CPLSleep(
double dfWaitInSeconds );
97 const char CPL_DLL *CPLGetThreadingModel(
void );
99 int CPL_DLL CPLGetNumCPUs(
void );
109 LOCK_RECURSIVE_MUTEX,
114 CPLLock CPL_DLL *CPLCreateLock( CPLLockType eType );
115 int CPL_DLL CPLCreateOrAcquireLock(
CPLLock**, CPLLockType eType );
116 int CPL_DLL CPLAcquireLock(
CPLLock* );
117 void CPL_DLL CPLReleaseLock(
CPLLock* );
118 void CPL_DLL CPLDestroyLock(
CPLLock* );
119 void CPL_DLL CPLLockSetDebugPerf(
CPLLock*,
int bEnableIn );
127 #define CPLMutexHolderD(x) CPLMutexHolder oHolder(x,1000.0,__FILE__,__LINE__); 131 #define CPLMutexHolderExD(x, nOptions) CPLMutexHolder oHolder(x,1000.0,__FILE__,__LINE__,nOptions); 135 #define CPLMutexHolderOptionalLockD(x) CPLMutexHolder oHolder(x,1000.0,__FILE__,__LINE__); 137 class CPL_DLL CPLMutexHolder
147 CPLMutexHolder( CPLMutex **phMutex,
double dfWaitInSeconds = 1000.0,
148 const char *pszFile = __FILE__,
149 int nLine = __LINE__,
150 int nOptions = CPL_MUTEX_RECURSIVE);
154 CPLMutexHolder( CPLMutex* hMutex,
double dfWaitInSeconds = 1000.0,
155 const char *pszFile = __FILE__,
156 int nLine = __LINE__ );
162 #define CPLLockHolderD(x, eType) CPLLockHolder oHolder(x,eType,__FILE__,__LINE__); 166 #define CPLLockHolderOptionalLockD(x) CPLLockHolder oHolder(x,__FILE__,__LINE__); 168 class CPL_DLL CPLLockHolder
178 CPLLockHolder(
CPLLock **phSpin, CPLLockType eType,
179 const char *pszFile = __FILE__,
180 int nLine = __LINE__);
185 const char *pszFile = __FILE__,
186 int nLine = __LINE__ );
198 #define CTLS_RLBUFFERINFO 1 199 #define CTLS_WIN32_COND 2 200 #define CTLS_CSVTABLEPTR 3 201 #define CTLS_CSVDEFAULTFILENAME 4 202 #define CTLS_ERRORCONTEXT 5 203 #define CTLS_GDALDATASET_REC_PROTECT_MAP 6 204 #define CTLS_PATHBUF 7 205 #define CTLS_UNUSED3 8 206 #define CTLS_UNUSED4 9 207 #define CTLS_CPLSPRINTF 10 208 #define CTLS_RESPONSIBLEPID 11 209 #define CTLS_VERSIONINFO 12 210 #define CTLS_VERSIONINFO_LICENCE 13 211 #define CTLS_CONFIGOPTIONS 14 212 #define CTLS_FINDFILE 15 217 void CPL_DLL * CPLGetTLS(
int nIndex );
218 void CPL_DLL CPLSetTLS(
int nIndex,
void *pData,
int bFreeOnExit );
222 typedef void (*CPLTLSFreeFunc)(
void* pData );
223 void CPL_DLL CPLSetTLSWithFreeFunc(
int nIndex,
void *pData, CPLTLSFreeFunc pfnFree );
225 void CPL_DLL CPLCleanupTLS(
void );
Definition: cpl_multiproc.cpp:59