openModeller
Version 1.5.0
Main Page
Modules
Classes
Files
File List
File Members
threads.hh
Go to the documentation of this file.
1
31
#ifndef _THREADS_HH_
32
#define _THREADS_HH_
33
34
#ifdef WIN32
35
36
// windows threading
37
#include <windows.h>
38
#include <process.h>
39
#define THREAD_PROC_RETURN_TYPE void
40
#define THREAD_PROC_RETURN_STATEMENT return;
41
42
#define THREAD_REDUCE_PRIORITY()\
43
{ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL); }
44
45
#define THREAD_START(threadProc, threadData)\
46
{ _beginthread(threadProc, 0, (void *) threadData); }
47
48
#define THREAD_END()\
49
{ _endthread(); }
50
51
#else
52
53
// posix threading (linux/unix/cygwin)
54
#include <pthread.h>
55
#include <sys/resource.h>
56
#define THREAD_PROC_RETURN_TYPE void *
57
#define THREAD_PROC_RETURN_STATEMENT return (NULL);
58
59
#define THREAD_REDUCE_PRIORITY()\
60
{ setpriority(PRIO_PROCESS, getpid(), 10); }
61
62
#define THREAD_START(threadProc, threadData)\
63
{ pthread_t pthread;\
64
pthread_create(&pthread, NULL, threadProc, threadData); }
65
66
#define THREAD_END()\
67
{ int status;\
68
pthread_exit(&status); }
69
70
71
#endif // WIN32
72
73
#endif // _THREADS_HH_
src
algorithms
best_subsets
threads.hh
Generated on Thu Jan 8 2015 17:05:10 for openModeller by
1.8.6