commore  1.0.6-SNAPSHOT
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
Action.h
1 //
2 // Copyright (c) 2006-2007 Raphael David / CANTOR
3 //
4 
5 #ifndef CMR_ACTION_H_INCLUDED
6 #define CMR_ACTION_H_INCLUDED
7 
8 #include "commore/Commore.h"
9 #include "commore/AutoRef.h"
10 #include "commore/Thread.h"
11 
12 
13 namespace commore
14 {
15  class Processor;
16  class ThreadItem;
17  struct ThreadActor;
18 
23  class CMREXD Action : public commore::RefObject
24  {
25  friend class ProcessorImpl;
26  friend class ThreadItem;
27  friend struct ThreadActor; // new impl
28  public:
29  Action();
30  virtual ~Action();
31 
32  public:
36  virtual void run();
37 
41  void submit(Processor& processor);
42 
50  void stop(Processor& processor, bool wait = true);
58  void abort(Processor& processor, bool wait = true);
59 
64  bool is_to_stop();
65  bool is_to_abort();
66  bool is_running();
67  bool is_stopped();
68 
76  int wait(Processor& processor, const int timeout_ms = 0);
77 
81  void reset();
82 
86  commore::CriticalSection* get_cs();
87 
88  private:
89  void run_();
90 
91  void set_submitted();
92  void unset_submitted();
93  void setAbort();
94  void set_to_abort();
95  void setStop();
96  void set_to_stop();
97  private:
98  struct Impl;
99  Impl* impl_;
100  };
102 };
103 #endif //CMR_ACTION_H_INCLUDED
104 
Definition: CriticalSection.h:15
Definition: RefObject.h:89
AutoRef is a smart pointer on RefObject objects. AutoRef is templatized with the type of the pointed ...
Definition: AutoRef.h:86
Definition: Action.h:23
Definition: Processor.h:16