VTK
vtkThreadMessager.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkThreadMessager.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
22 #ifndef __vtkThreadMessager_h
23 #define __vtkThreadMessager_h
24 
25 #include "vtkObject.h"
26 
27 #if defined(VTK_USE_PTHREADS) || defined(VTK_HP_PTHREADS)
28 #include <pthread.h> // Needed for pthread types
29 #endif
30 
32 {
33 public:
34  static vtkThreadMessager *New();
35 
37  void PrintSelf(ostream& os, vtkIndent indent);
38 
40  void WaitForMessage();
41 
43  void SendWakeMessage();
44 
48  void EnableWaitForReceiver();
49 
53  void DisableWaitForReceiver();
54 
57  void WaitForReceiver();
58 
59 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
60 # define SendMessageA SendMessage
61 # define SendMessageW SendMessage
62 #endif
63 
66  VTK_LEGACY(void SendMessage());
67 
68 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
69 # undef SendMessageW
70 # undef SendMessageA
71  //BTX
72  VTK_LEGACY(void SendMessageA());
73  VTK_LEGACY(void SendMessageW());
74  //ETX
75 #endif
76 
77 protected:
80 
81 #ifdef VTK_USE_PTHREADS
82  pthread_mutex_t Mutex;
83  pthread_cond_t PSignal;
84 #endif
85 
86 #ifdef VTK_USE_WIN32_THREADS
87  vtkWindowsHANDLE WSignal;
88 #endif
89 
90 private:
91  vtkThreadMessager(const vtkThreadMessager&); // Not implemented.
92  void operator=(const vtkThreadMessager&); // Not implemented.
93 };
94 
95 #endif
96 
97 
98 
99 
100 
abstract base class for most VTK objects
Definition: vtkObject.h:60
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:37
#define VTK_COMMON_EXPORT
A class for performing inter-thread messaging.
static vtkObject * New()