ACE_Task_Base Class ReferenceDirect base class for the ACE_Task template. More...
Inheritance diagram for ACE_Task_Base:
Collaboration diagram for ACE_Task_Base:
Detailed DescriptionDirect base class for the ACE_Task template.This class factors out the non-template code in order to reduce template bloat, as well as to make it possible for the ACE_Thread_Manager to store ACE_Task_Base *'s polymorphically. Constructor & Destructor Documentation
Constructor.
Destructor.
Member Function Documentation
Hook called to initialize a task and prepare it for execution. args can be used to pass arbitrary information into <open>. Reimplemented in ACE_Stream_Head<>, ACE_Stream_Tail<>, ACE_Thru_Task<>, ACE_Svc_Handler<, >, and ACE_Svc_Handler< ACE_PEER_STREAM_2, ACE_SYNCH_USE >.
Hook called from ACE_Thread_Exit when during thread exit and from the default implementation of <module_closed>. In general, this method shouldn't be called directly by an application, particularly if the <Task> is running as an Active Object. Instead, a special message should be passed into the <Task> via the <put> method defined below, and the <svc> method should interpret this as a flag to shut down the <Task>. Reimplemented in ACE_Stream_Head<>, ACE_Stream_Tail<>, ACE_Thru_Task<>, ACE_Svc_Handler<, >, and ACE_Svc_Handler< ACE_PEER_STREAM_2, ACE_SYNCH_USE >.
Hook called during <ACE_Module::close>. The default implementation calls forwards the call to close(1). Please notice the changed value of the default argument of <close>. This allows tasks to differ between the call has been originated from <ACE_Thread_Exit> or from <module_closed>. Be aware that close(0) will be also called when a thread associated with the ACE_Task instance exits.
A hook method that can be used to pass a message to a task, where it can be processed immediately or queued for subsequent processing in the <svc> hook method. Reimplemented in ACE_Stream_Head<>, ACE_Stream_Tail<>, ACE_Thru_Task<>, and ACE_Buffered_Svc_Handler<, >.
Run by a daemon thread to handle deferred processing.
Reimplemented in ACE_Asynch_Pseudo_Task, ACE_Proactor_Timer_Handler, ACE_Stream_Head<>, ACE_Stream_Tail<>, ACE_Thru_Task<>, and ACE_Thread_Timer_Queue_Adapter< TQ >.
Turn the task into an active object, i.e., having n_threads of control, all running at the priority level (see below) with the same grp_id, all of which invoke <Task::svc>. Returns -1 if failure occurs, returns 1 if Task is already an active object and force_active is false (i.e., do *not* create a new thread in this case), and returns 0 if Task was not already an active object and a thread is created successfully or thread is an active object and force_active is true. Note that if force_active is true and there are already threads spawned in this <Task>, the grp_id parameter is ignored and the grp_id of any newly activated thread(s) will inherit the existing grp_id of the existing thread(s) in the <Task>. The <{flags}> are a bitwise-OR of the following: = BEGIN<INDENT> THR_CANCEL_DISABLE, THR_CANCEL_ENABLE, THR_CANCEL_DEFERRED, THR_CANCEL_ASYNCHRONOUS, THR_BOUND, THR_NEW_LWP, THR_DETACHED, THR_SUSPENDED, THR_DAEMON, THR_JOINABLE, THR_SCHED_FIFO, THR_SCHED_RR, THR_SCHED_DEFAULT, THR_EXPLICIT_SCHED, THR_SCOPE_SYSTEM, THR_SCOPE_PROCESS = END<INDENT> If THR_SCHED_INHERIT is not desirable, applications should specifically pass in THR_EXPLICIT_SCHED. By default, or if <{priority}> is set to ACE_DEFAULT_THREAD_PRIORITY, an "appropriate" priority value for the given scheduling policy (specified in <{flags}>, e.g., <THR_SCHED_DEFAULT>) is used. This value is calculated dynamically, and is the median value between the minimum and maximum priority values for the given policy. If an explicit value is given, it is used. Note that actual priority values are EXTREMEMLY implementation-dependent, and are probably best avoided.
If thread_handles != 0 it is assumed to be an array of n thread_handles that will be assigned the values of the thread handles being spawned. Returns -1 on failure (
Assigning task allows you to associate the newly spawned threads with an instance of ACE_Task_Base. If task == 0, then the new threads are associated automatically with If stack != 0 it is assumed to be an array of n pointers to the base of the stacks to use for the threads being spawned. Likewise, if stack_size != 0 it is assumed to be an array of n values indicating how big each of the corresponding stacks are. Reimplemented in ACE_Thread_Timer_Queue_Adapter< TQ >.
Block until there are no more threads running in this task. This method will not wait for either detached or daemon threads; the threads must have been spawned with the
Get the current group id.
Set the current group id.
Get the thread manager associated with this Task.
Set the thread manager associated with this Task.
True if queue is a reader, else false.
True if queue is a writer, else false.
Returns the number of threads currently running within a task. If we're a passive object this value is 0, else it's greater than 0.
Returns the thread ID of the thread whose exit caused this object's thread count to be decremented to 0. When a thread spawned in the context of this object (using activate()) returns from its svc() method ACE calls the close() hook. Before it does so, it decrements the number of active threads. If the number of threads is decremented to 0, the thread ID of the current thread is stored for access by this method. If the returned thread ID matches the calling thread's ID, the calling thread knows that there are no other threads still active in the ACE_Task.
Routine that runs the service routine as a daemon thread.
Cleanup hook that is called when a thread exits to gracefully shutdown an ACE_Task.
Member Data Documentation
Count of the number of threads running within the task. If this value is greater than 0 then we're an active object and the value of <thr_count_> is the number of active threads at this instant. If the value == 0, then we're a passive object.
Multi-threading manager.
ACE_Task flags.
This maintains the group id of the Task.
Holds the thread ID of the last thread to exit svc() in this object.
The documentation for this class was generated from the following files: Generated on Mon Sep 15 07:17:31 2008 for ACE by 1.5.5 |