openModeller
Version 1.4.0
|
00001 00031 #ifndef _GARP_RUN_THREAD_HH_ 00032 #define _GARP_RUN_THREAD_HH_ 00033 00034 #ifdef WIN32 00035 00036 // windows threading 00037 #include <windows.h> 00038 #include <process.h> 00039 #define THREAD_PROC_RETURN_TYPE void 00040 #define THREAD_PROC_RETURN_STATEMENT return; 00041 00042 #define THREAD_REDUCE_PRIORITY()\ 00043 { SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL); } 00044 00045 #define THREAD_START(threadProc, threadData)\ 00046 { _beginthread(threadProc, 0, (void *) threadData); } 00047 00048 #define THREAD_END()\ 00049 { _endthread(); } 00050 00051 #else 00052 00053 // posix threading (linux/unix/cygwin) 00054 #include <pthread.h> 00055 #include <sys/resource.h> 00056 #define THREAD_PROC_RETURN_TYPE void * 00057 #define THREAD_PROC_RETURN_STATEMENT return (NULL); 00058 00059 #define THREAD_REDUCE_PRIORITY()\ 00060 { setpriority(PRIO_PROCESS, getpid(), 10); } 00061 00062 #define THREAD_START(threadProc, threadData)\ 00063 { pthread_t pthread;\ 00064 pthread_create(&pthread, NULL, threadProc, threadData); } 00065 00066 #define THREAD_END()\ 00067 { int status;\ 00068 pthread_exit(&status); } 00069 00070 00071 #endif // WIN32 00072 00073 #endif // _GARP_RUN_THREAD_HH_