commore  1.0.6-SNAPSHOT
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Processor.h
Go to the documentation of this file.
1 #ifndef CMR_PROCESSOR_H_INCLUDED
2 #define CMR_PROCESSOR_H_INCLUDED
3 
4 #include "Action.h"
5 #include "ActionGroup.h"
6 
7 namespace commore
8 {
9  typedef bool (*ProcessFunction)(void*);
10 
17  {
18  public:
19  struct HImpl;
20  private:
21  HImpl* himpl_;
22  public:
32  Processor(const char* name, const int nb_max_thread, int min_thread);
33  Processor(const int nb_max_thread, int min_thread);
34  ~Processor();
35  Processor(const Processor&);
36  Processor& operator = (const Processor&);
37 
45  bool start(const char* name, int min_thread = 0, int max_thread = 64);
46  public:
52  bool submit(const PAction& action);
53 
59  bool submit(ActionGroup& actions);
60 
66  bool submit(ProcessFunction f, void* p);
67 
72  void remove_from_submitted_action(const PAction& action);
73 
78  void pause();
79 
83  void resume();
84 
88  bool stop();
89 
93  void abort();
94 
99  const AString& get_name() const;
100 
104  bool waitAction(const PAction& action, const int nTimeOut_ms = 0);
105 
109  void waitIdle();
110 
115  void terminate();
116 
117  static Processor& getDefaultProcessor();
118  };
119 
120 }
121 
122 #endif //CMR_PROCESSOR_H_INCLUDED
Definition: AString.h:39
Definition: ActionGroup.h:12
#define CMREXD
Definition: Compiler.h:22
Definition: Processor.cpp:30
AutoRef is a smart pointer on RefObject objects. AutoRef is templatized with the type of the pointed ...
Definition: AutoRef.h:86
bool(* ProcessFunction)(void *)
Definition: Processor.h:9
Definition: Processor.h:16