VTK
dox/Filtering/vtkExecutionScheduler.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkExecutionScheduler.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 =========================================================================*/
00015 /*-------------------------------------------------------------------------
00016   Copyright (c) 2008, 2009 by SCI Institute, University of Utah.
00017   
00018   This is part of the Parallel Dataflow System originally developed by
00019   Huy T. Vo and Claudio T. Silva. For more information, see:
00020 
00021   "Parallel Dataflow Scheme for Streaming (Un)Structured Data" by Huy
00022   T. Vo, Daniel K. Osmari, Brian Summa, Joao L.D. Comba, Valerio
00023   Pascucci and Claudio T. Silva, SCI Institute, University of Utah,
00024   Technical Report #UUSCI-2009-004, 2009.
00025 
00026   "Multi-Threaded Streaming Pipeline For VTK" by Huy T. Vo and Claudio
00027   T. Silva, SCI Institute, University of Utah, Technical Report
00028   #UUSCI-2009-005, 2009.
00029 -------------------------------------------------------------------------*/
00047 #ifndef __vtkExecutionScheduler_h
00048 #define __vtkExecutionScheduler_h
00049 
00050 #include "vtkObject.h"
00051 
00052 class vtkExecutive;
00053 class vtkComputingResources;
00054 class vtkMultiThreader;
00055 class vtkMutexLock;
00056 class vtkThreadMessager;
00057 class vtkInformation;
00058 class vtkInformationIntegerKey;
00059 class vtkExecutiveCollection;
00060 
00061 class VTK_FILTERING_EXPORT vtkExecutionScheduler : public vtkObject
00062 {
00063 public:
00064   static vtkExecutionScheduler* New();
00065   vtkTypeMacro(vtkExecutionScheduler,vtkObject);
00066   void PrintSelf(ostream &os, vtkIndent indent);
00067 
00069   static vtkExecutionScheduler *GetGlobalScheduler();
00070 
00072   static vtkInformationIntegerKey* TASK_PRIORITY();
00073 
00077   void Schedule(vtkExecutiveCollection *execs, vtkInformation *info);
00078   
00082   void SchedulePropagate(vtkExecutiveCollection *execs, vtkInformation *info);
00083   
00086   void WaitUntilDone(vtkExecutiveCollection *execs);
00087   
00090   void WaitUntilReleased(vtkExecutiveCollection *execs);
00091 
00093   void WaitUntilAllDone();
00094   
00098   void WaitForTaskDone(vtkExecutive *exec);
00099   
00102   void WaitForInputsReleased(vtkExecutive *exec);
00103   
00106   vtkThreadMessager* GetTaskDoneMessager(vtkExecutive *exec);
00107 
00110   vtkThreadMessager* GetInputsReleasedMessager(vtkExecutive *exec);
00111 
00114   vtkMutexLock* GetInputsReleasedLock(vtkExecutive *exec);
00115 
00117   void ReleaseResources(vtkExecutive *exec);
00118 
00120   void ReacquireResources(vtkExecutive *exec);
00121 
00124   void RescheduleNetwork(vtkExecutive *sink);
00125   
00128   void RescheduleFrom(vtkExecutive *sink, vtkComputingResources *resources);
00129 
00130 protected:
00131   vtkExecutionScheduler();
00132   ~vtkExecutionScheduler();
00133 
00134   vtkComputingResources       *Resources;
00135   vtkThreadMessager           *ScheduleMessager;
00136   vtkThreadMessager           *ResourceMessager;
00137   vtkMutexLock                *ScheduleLock;
00138   vtkMultiThreader            *ScheduleThreader;
00139   int                          ScheduleThreadId;
00140 
00141 //BTX
00142   class implementation;
00143   implementation* const Implementation;
00144   friend class implementation;
00145 
00148   friend void * vtkExecutionScheduler_ScheduleThread(void *data);
00149 
00152   friend void * vtkExecutionScheduler_ExecuteThread(void *data);
00153 
00154 //ETX
00155 
00156 private:
00157   vtkExecutionScheduler(const vtkExecutionScheduler&);  // Not implemented.
00158   void operator=(const vtkExecutionScheduler&);  // Not implemented.
00159   
00160 };
00161 
00162 #endif