Changeset 3855 in Sophya for trunk/SophyaLib/SysTools/parlex.h
- Timestamp:
- Aug 12, 2010, 1:02:24 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SysTools/parlex.h
r3718 r3855 5 5 6 6 // Classes pour execution de taches paralleles en utilisant les threads 7 // R. Ansari UPS+LAL IN2P3/CNRS 200 57 // R. Ansari UPS+LAL IN2P3/CNRS 2009-2010 8 8 9 9 #include "zthread.h" … … 17 17 // s'executer en parallele 18 18 //-------------------------------------------------------------------- 19 /*!20 \class ParallelTaskInterface21 \ingroup SysTools22 \brief Interface definition for parallel task object.23 24 The pure virtual method execute() should be redefined by the classes25 inheriting from ParallelTaskInterface26 */27 19 class ParallelTaskInterface { 28 20 public: 29 explicit ParallelTaskInterface() { }30 virtual ~ParallelTaskInterface() { }21 explicit ParallelTaskInterface(); 22 virtual ~ParallelTaskInterface(); 31 23 /*! This method should perform the actual computation. The parameter tid 32 24 is used by the ParallelExecutor class to identify the thread calling the method 33 25 */ 34 26 virtual int execute(int tid) = 0; 27 //! Define the number of parallel threads running to perform the task (set by ParallelExecutor object) 28 virtual void setNbParallelThreads(int nbparthr); 29 //! Return the number of parallel threads running to perform the task 30 inline int getNbParallelThreads() { return nbparallel_; } 31 protected: 32 int nbparallel_; // total number of parallel threads which will perform the job 35 33 }; 36 34 37 35 //---- Implementation de ParallelTaskInterface pour l'execution des fonctions 38 typedef int (* ParalExFunction) (int); 36 //! Prototype for functions which executed by ParallelTaskFunction objects 37 typedef int (* ParalExFunction) (int,int); 39 38 //---- 40 class ParallelTaskFunction{39 class ParallelTaskFunction : public ParallelTaskInterface { 41 40 public: 42 41 explicit ParallelTaskFunction(ParalExFunction f); … … 116 115 //! Return RC for the ParalleTask.execute() of thread i 117 116 inline int getRC(size_t i) { return vrc_[i]; } 118 //! Return the ex ecption condition for the ParalleTask.execute() of thread i117 //! Return the exception condition for the ParalleTask.execute() of thread i 119 118 inline bool IfException(size_t i, string& msg) { return vpext_[i]->IfException(msg); } 120 119
Note:
See TracChangeset
for help on using the changeset viewer.