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, C++ or Win32 exception, "falling off the end" of Task::svc_run, etc.).

SYNOPSIS

#include <ace/Task.h>

class ACE_Task_Exit { public: ACE_Task_Exit (void); void set_task (ACE_Task_Base *t); ACE_Task_Base *get_task (void); void *status (void *s); void *status (void); ~ACE_Task_Exit (void); static ACE_Task_Exit *instance (void); private: ACE_Task_Base *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 deletes this object, thereby closing it down gracefully.

PUBLIC MEMBERS

ACE_Task_Exit (void);

void set_task (ACE_Task_Base *t);

ACE_Task_Base *get_task (void);

void *status (void *s);

void *status (void);

~ACE_Task_Exit (void);

static ACE_Task_Exit *instance (void);

PRIVATE MEMBERS

ACE_Task_Base *t_;

void *status_;

ACE_Thread_Control tc_;

static ACE_Thread_Mutex ace_task_lock_;

AUTHOR

Doug Schmidt

LIBRARY

ace