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 =========================================================================*/
23 #ifndef vtkThreadMessager_h
24 #define vtkThreadMessager_h
25 
26 #include "vtkCommonSystemModule.h" // For export macro
27 #include "vtkObject.h"
28 
29 #if defined(VTK_USE_PTHREADS)
30 #include <pthread.h> // Needed for pthread types
31 #endif
32 
33 class VTKCOMMONSYSTEM_EXPORT vtkThreadMessager : public vtkObject
34 {
35 public:
36  static vtkThreadMessager *New();
37 
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
45  void WaitForMessage();
46 
51  void SendWakeMessage();
52 
58  void EnableWaitForReceiver();
59 
65  void DisableWaitForReceiver();
66 
72  void WaitForReceiver();
73 
74 protected:
76  ~vtkThreadMessager() override;
77 
78 #ifdef VTK_USE_PTHREADS
79  pthread_mutex_t Mutex;
80  pthread_cond_t PSignal;
81 #endif
82 
83 #ifdef VTK_USE_WIN32_THREADS
84  vtkWindowsHANDLE WSignal;
85 #endif
86 
87 private:
88  vtkThreadMessager(const vtkThreadMessager&) = delete;
89  void operator=(const vtkThreadMessager&) = delete;
90 };
91 
92 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:59
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:39
A class for performing inter-thread messaging.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...