VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkThreadMessager.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00022 #ifndef __vtkThreadMessager_h 00023 #define __vtkThreadMessager_h 00024 00025 #include "vtkCommonSystemModule.h" // For export macro 00026 #include "vtkObject.h" 00027 00028 #if defined(VTK_USE_PTHREADS) || defined(VTK_HP_PTHREADS) 00029 #include <pthread.h> // Needed for pthread types 00030 #endif 00031 00032 class VTKCOMMONSYSTEM_EXPORT vtkThreadMessager : public vtkObject 00033 { 00034 public: 00035 static vtkThreadMessager *New(); 00036 00037 vtkTypeMacro(vtkThreadMessager,vtkObject); 00038 void PrintSelf(ostream& os, vtkIndent indent); 00039 00041 void WaitForMessage(); 00042 00044 void SendWakeMessage(); 00045 00049 void EnableWaitForReceiver(); 00050 00054 void DisableWaitForReceiver(); 00055 00058 void WaitForReceiver(); 00059 00060 protected: 00061 vtkThreadMessager(); 00062 ~vtkThreadMessager(); 00063 00064 #ifdef VTK_USE_PTHREADS 00065 pthread_mutex_t Mutex; 00066 pthread_cond_t PSignal; 00067 #endif 00068 00069 #ifdef VTK_USE_WIN32_THREADS 00070 vtkWindowsHANDLE WSignal; 00071 #endif 00072 00073 private: 00074 vtkThreadMessager(const vtkThreadMessager&); // Not implemented. 00075 void operator=(const vtkThreadMessager&); // Not implemented. 00076 }; 00077 00078 #endif