NAME

ACE_Task_Exit - Keep exit information for a Task in thread specific storage so that the Task::close() method will get called no matter how the thread exits (e.g., via Thread::exit() or by "falling off the end of Task::svc_run").

SYNOPSIS


#include <ace/Task.h>


template<ACE_SYNCH_1>
class ACE_Task_Exit
{
  public:
    ACE_Task_Exit (void);
    void set_this (ACE_Task<ACE_SYNCH_2> *t);
    void *status (void *s);
    void *status (void);
    ~ACE_Task_Exit (void);
    static ACE_Task_Exit<ACE_SYNCH_2> *instance (void);
  private:
    ACE_Task<ACE_SYNCH_2> *t_;
    void *status_;
    ACE_Thread_Control tc_;
    static ACE_Thread_Mutex ace_task_lock_;
};

DESCRIPTION

This clever little helper class is stored in thread-specific storage using the ACE_TSS wrapper. When a thread exits the ACE_TSS::cleanup() function calls "delete" on this object, thereby closing it down gracefully.

PUBLIC MEMBERS

ACE_Task_Exit (void);
void set_this (ACE_Task<ACE_SYNCH_2> *t);
void *status (void *s);
void *status (void);
~ACE_Task_Exit (void);
static ACE_Task_Exit<ACE_SYNCH_2> *instance (void);

PRIVATE MEMBERS

ACE_Task<ACE_SYNCH_2> *t_;
void *status_;
ACE_Thread_Control tc_;
static ACE_Thread_Mutex ace_task_lock_;

AUTHOR

Doug Schmidt

LIBRARY

ace