VTK  9.2.6
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 "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_1_0
27 
28 #include "vtkCommonSystemModule.h" // For export macro
29 #include "vtkObject.h"
30 #include "vtkThreads.h" // for VTK_USE_PTHREADS and VTK_USE_WIN32_THREADS
31 
32 #if defined(VTK_USE_PTHREADS)
33 #include <pthread.h> // Needed for pthread types
34 #endif
35 
37  "Use C++ STL threading classes") VTKCOMMONSYSTEM_EXPORT vtkThreadMessager : public vtkObject
38 {
39 public:
40  static vtkThreadMessager* New();
41 
42  vtkTypeMacro(vtkThreadMessager, vtkObject);
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
49  void WaitForMessage();
50 
55  void SendWakeMessage();
56 
62  void EnableWaitForReceiver();
63 
69  void DisableWaitForReceiver();
70 
76  void WaitForReceiver();
77 
78 protected:
80  ~vtkThreadMessager() override;
81 
82 #ifdef VTK_USE_PTHREADS
83  pthread_mutex_t Mutex;
84  pthread_cond_t PSignal;
85 #endif
86 
87 #ifdef VTK_USE_WIN32_THREADS
88  vtkWindowsHANDLE WSignal;
89 #endif
90 
91 private:
92  vtkThreadMessager(const vtkThreadMessager&) = delete;
93  void operator=(const vtkThreadMessager&) = delete;
94 };
95 
96 #endif
97 
98 // VTK-HeaderTest-Exclude: vtkThreadMessager.h
#define VTK_DEPRECATED_IN_9_1_0(reason)
abstract base class for most VTK objects
Definition: vtkObject.h:62
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...