MeVisLab Toolbox Reference
DCMTree_ThreadSupport.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef DCM_TREE_THREAD_SUPPORT_H
14 #define DCM_TREE_THREAD_SUPPORT_H
15 
16 #ifdef WIN32
17  #ifndef NOMINMAX
18  #define NOMINMAX
19  #endif
20  #include <process.h>
21  #include <windows.h>
22  #include <winbase.h>
23  #undef small
24 #else
25  #include <csignal>
26  #include <pthread.h>
27 #endif
28 
29 #include "DCMTree_Defines.h"
30 
31 
32 namespace DCMTree_Utils
33 {
35  typedef void* thread_parameter;
36 
37  #ifdef WIN32
38  #define thread_modifier __stdcall
39  typedef unsigned int thread_result;
40  typedef HANDLE thread_id;
42  typedef CRITICAL_SECTION thread_criticalsection;
43  #else
44  #define thread_modifier
45  typedef void* thread_result;
46  typedef pthread_t thread_id;
48  typedef pthread_mutex_t thread_criticalsection;
49  #endif
50 
51 
52  // system independent multi threading functions
53 
55 
60 
62 
66 
68 
72 
74 
78 
80 
84 
86 
90 
92 
96 
99  {
100  public:
102  {
104  };
105 
107  {
109  };
110 
111  private:
113 
117  };
118 }
119 
120 #endif
121 
122 
#define DCMTREE_EXPORT
#define thread_modifier
void * HANDLE
Definition: WEM.h:23
Class to manage thread specific critical sections.
thread_scoped_criticalsection(thread_criticalsection &cs)
dictionary class to provide dicom-meta information
void * thread_parameter
System dependent types and definitions.
void DCMTREE_EXPORT thread_initcriticalsection(thread_criticalsection &cs)
Prepare a critical section for further usage.
thread_id DCMTREE_EXPORT thread_start(thread_function func, thread_parameter param)
Start func as a new thread, param as parameter (void-pointer :) )
void DCMTREE_EXPORT thread_destroycriticalsection(thread_criticalsection &cs)
Destroy a critical section.
thread_result(thread_modifier * thread_function)(thread_parameter)
unsigned int thread_result
void DCMTREE_EXPORT thread_await(thread_id id)
Wait for a thread to complete its work.
void DCMTREE_EXPORT thread_entercriticalsection(thread_criticalsection &cs)
Enter a critical section.
CRITICAL_SECTION thread_criticalsection
void DCMTREE_EXPORT thread_leavecriticalsection(thread_criticalsection &cs)
Leave a critical section.
bool DCMTREE_EXPORT thread_running(thread_id id)
Test if a thread is running.