Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkThreadMessager.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkThreadMessager.h,v $
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 =========================================================================*/
00032 #ifndef __vtkThreadMessager_h
00033 #define __vtkThreadMessager_h
00034 
00035 #include "vtkObject.h"
00036 
00037 #if defined(VTK_USE_PTHREADS) || defined(VTK_HP_PTHREADS)
00038 #include <pthread.h> // Needed for pthread types
00039 #endif
00040 
00041 class VTK_COMMON_EXPORT vtkThreadMessager : public vtkObject 
00042 {
00043 public:
00044   static vtkThreadMessager *New();
00045 
00046   vtkTypeRevisionMacro(vtkThreadMessager,vtkObject);
00047   void PrintSelf(ostream& os, vtkIndent indent);
00048 
00050   void WaitForMessage();
00051 
00053   void SendMessage();
00054 
00058   void EnableWaitForReceiver();
00059 
00063   void DisableWaitForReceiver();
00064 
00067   void WaitForReceiver();
00068 
00069 protected:
00070   vtkThreadMessager();
00071   ~vtkThreadMessager();
00072 
00073 #ifdef VTK_USE_PTHREADS
00074   pthread_mutex_t Mutex;
00075   pthread_cond_t PSignal;
00076 #endif
00077 
00078 #ifdef VTK_USE_WIN32_THREADS
00079   HANDLE WSignal;
00080 #endif
00081 
00082 private:
00083   vtkThreadMessager(const vtkThreadMessager&);  // Not implemented.
00084   void operator=(const vtkThreadMessager&);  // Not implemented.
00085 };
00086 
00087 #endif
00088 
00089 
00090 
00091 
00092