cpl_multiproc.h
00001
00002
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 #ifndef _CPL_MULTIPROC_H_INCLUDED_
00031 #define _CPL_MULTIPROC_H_INCLUDED_
00032
00033 #include "cpl_port.h"
00034
00035
00036
00037
00038
00039
00040
00041
00042 #if defined(WIN32) && !defined(CPL_MULTIPROC_STUB)
00043 # define CPL_MULTIPROC_WIN32
00044 #endif
00045
00046 #if !defined(CPL_MULTIPROC_WIN32) && !defined(CPL_MULTIPROC_PTHREAD) \
00047 && !defined(CPL_MULTIPROC_STUB) && !defined(CPL_MULTIPROC_NONE)
00048 # define CPL_MULTIPROC_STUB
00049 #endif
00050
00051 CPL_C_START
00052
00053 typedef void (*CPLThreadFunc)(void *);
00054
00055 void CPL_DLL *CPLLockFile( const char *pszPath, double dfWaitInSeconds );
00056 void CPL_DLL CPLUnlockFile( void *hLock );
00057
00058 void CPL_DLL *CPLCreateMutex();
00059 int CPL_DLL CPLCreateOrAcquireMutex( void **, double dfWaitInSeconds );
00060 int CPL_DLL CPLAcquireMutex( void *hMutex, double dfWaitInSeconds );
00061 void CPL_DLL CPLReleaseMutex( void *hMutex );
00062 void CPL_DLL CPLDestroyMutex( void *hMutex );
00063
00064 GIntBig CPL_DLL CPLGetPID();
00065 int CPL_DLL CPLCreateThread( CPLThreadFunc pfnMain, void *pArg );
00066 void CPL_DLL CPLSleep( double dfWaitInSeconds );
00067
00068 const char CPL_DLL *CPLGetThreadingModel();
00069
00070 CPL_C_END
00071
00072 #ifdef __cplusplus
00073
00074 #define CPLMutexHolderD(x) CPLMutexHolder oHolder(x,1000.0,__FILE__,__LINE__);
00075
00076 class CPL_DLL CPLMutexHolder
00077 {
00078 private:
00079 void *hMutex;
00080 const char *pszFile;
00081 int nLine;
00082
00083 public:
00084
00085 CPLMutexHolder( void **phMutex, double dfWaitInSeconds = 1000.0,
00086 const char *pszFile = __FILE__,
00087 int nLine = __LINE__ );
00088 ~CPLMutexHolder();
00089 };
00090 #endif
00091
00092
00093
00094
00095
00096 #define CTLS_RLBUFFERINFO 1
00097 #define CTLS_DECDMSBUFFER 2
00098 #define CTLS_CSVTABLEPTR 3
00099 #define CTLS_CSVDEFAULTFILENAME 4
00100 #define CTLS_ERRORCONTEXT 5
00101 #define CTLS_FINDERINFO 6
00102 #define CTLS_PATHBUF 7
00103 #define CTLS_SPRINTFBUF 8
00104 #define CTLS_SWQ_ERRBUF 9
00105 #define CTLS_CPLSPRINTF 10
00106 #define CTLS_RESPONSIBLEPID 11
00107 #define CTLS_VERSIONINFO 12
00108 #define CTLS_VERSIONINFO_LICENCE 13
00109 #define CTLS_CONFIGOPTIONS 14
00110 #define CTLS_FINDFILE 15
00111
00112 #define CTLS_MAX 32
00113
00114 CPL_C_START
00115 void CPL_DLL * CPLGetTLS( int nIndex );
00116 void CPL_DLL CPLSetTLS( int nIndex, void *pData, int bFreeOnExit );
00117 void CPL_DLL CPLCleanupTLS();
00118 CPL_C_END
00119
00120 #endif