NAME

ACE_Task_Base - Direct base class for the ACE_Task template.

SYNOPSIS

#include <ace/Task.h>

class ACE_Task_Base : public ACE_Service_Object { public: ACE_Task_Base (ACE_Thread_Manager * = 0); virtual ~ACE_Task_Base (void); virtual int open (void *args = 0); virtual int close (u_long flags = 0); virtual int module_closed (void); virtual int put (ACE_Message_Block *, ACE_Time_Value * = 0); virtual int svc (void); virtual int activate ( long flags = THR_NEW_LWP | THR_JOINABLE, int n_threads = 1, int force_active = 0, long priority = ACE_DEFAULT_THREAD_PRIORITY, int grp_id = -1, ACE_Task_Base *task = 0, ACE_hthread_t thread_handles[] = 0, void *stack[] = 0, size_t stack_size[] = 0, ACE_thread_t thread_ids[] = 0 ); virtual int wait (void); virtual int suspend (void); virtual int resume (void); int grp_id (void) const; void grp_id (int); ACE_Thread_Manager *thr_mgr (void) const; void thr_mgr (ACE_Thread_Manager *); int is_reader (void) const; int is_writer (void) const; size_t thr_count (void) const; void thr_count_dec (void); static void *svc_run (void *); static void cleanup (void *object, void *params); size_t thr_count_; ACE_Thread_Manager *thr_mgr_; u_long flags_; int grp_id_; ACE_Thread_Mutex lock_; private: ACE_Task_Base &operator= (const ACE_Task_Base &); ACE_Task_Base (const ACE_Task_Base &); };

DESCRIPTION

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.

Initialization and termination methods.

ACE_Task_Base (ACE_Thread_Manager * = 0);

virtual ~ACE_Task_Base (void);

Initialization and termination hooks.

These methods should be overridden by subclasses if you'd like to provide Task-specific initialization and termination behavior.
virtual int open (void *args = 0);

virtual int close (u_long flags = 0);

virtual int module_closed (void);

Immediate and deferred processing methods, respectively.

These methods should be overridden by subclasses if you'd like to provide Task-specific message processing behavior.
virtual int put (ACE_Message_Block *, ACE_Time_Value * = 0);

virtual int svc (void);

Active object activation method.

virtual int activate (
    long flags = THR_NEW_LWP | THR_JOINABLE,
    int n_threads = 1,
    int force_active = 0,
    long priority = ACE_DEFAULT_THREAD_PRIORITY,
    int grp_id = -1,
    ACE_Task_Base *task = 0,
    ACE_hthread_t thread_handles[] = 0,
    void *stack[] = 0,
    size_t stack_size[] = 0,
    ACE_thread_t thread_ids[] = 0
    );

virtual int wait (void);

Suspend/resume a Task

virtual int suspend (void);

virtual int resume (void);

int grp_id (void) const;

void grp_id (int);

ACE_Thread_Manager *thr_mgr (void) const;

void thr_mgr (ACE_Thread_Manager *);

int is_reader (void) const;

int is_writer (void) const;

size_t thr_count (void) const;

void thr_count_dec (void);

static void *svc_run (void *);

static void cleanup (void *object, void *params);

Internal data (should be private...).

private:
size_t thr_count_;

ACE_Thread_Manager *thr_mgr_;

u_long flags_;

int grp_id_;

ACE_Thread_Mutex lock_;

Disallow these operations.

ACE_Task_Base &operator= (const ACE_Task_Base &);

ACE_Task_Base (const ACE_Task_Base &);

AUTHOR

Doug Schmidt

LIBRARY

ace