2 * @file Task_Activator.h
4 * @author Carlos O'Ryan <coryan@uci.edu>
7 #ifndef TAO_PERF_RTEC_TASK_ACTIVATOR_H
8 #define TAO_PERF_RTEC_TASK_ACTIVATOR_H
11 #include "ace/Copy_Disabled.h"
13 #if !defined (ACE_LACKS_PRAGMA_ONCE)
15 #endif /* ACE_LACKS_PRAGMA_ONCE */
18 * @class Task_Activator
20 * @brief Simplify the activation and destruction of tasks
23 class Task_Activator
: private ACE_Copy_Disabled
28 * @todo If we were to define a generic ACE class for this then we
29 * should certainly change the constructor. For example, we
30 * should pass an structure with all the thread activation
31 * arguments, like:<BR>
32 * Activation_Properties properties;<BR>
33 * Task_Activator<Foo> activator (properties, foo);<BR>
35 * The advantage of using an structure instead of a long list
36 * of arguments is that the user can change some of the
37 * defaults without having to know all the other values, plus
38 * it evolves better: over time if arguments are added the
39 * client code does not change.<BR>
41 * With a little trickery we can even change the arguments in
43 * Activation_Properties props ().priority (x).stack_size (y);<BR>
45 * all you need to do is return <CODE>*this</CODE> from each
49 Task_Activator (int priority
,
56 * Wait until the task terminates before returning, this is useful
57 * in programs that need to guarantee that the task object is not
58 * destroyed before the underlying threads finished.
59 * However, the use of this class implicitly requires that the task
60 * will eventually terminate!
62 * Sometimes it is better to derive from this class and implement a
63 * cooperative termination protocol in the destructor of the derived
66 ~Task_Activator (void);
68 /// Release the task, do not terminate it
75 #if defined(__ACE_INLINE__)
76 #include "Task_Activator.inl"
77 #endif /* __ACE_INLINE__ */
79 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
80 #include "Task_Activator.cpp"
81 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
83 #endif /* TAO_PERF_RTEC_TASK_ACTIVATOR_H */