Public Member Functions | Protected Member Functions | Protected Attributes

ACE_Asynch_Pseudo_Task Class Reference

#include <Asynch_Pseudo_Task.h>

Inheritance diagram for ACE_Asynch_Pseudo_Task:
Inheritance graph
[legend]
Collaboration diagram for ACE_Asynch_Pseudo_Task:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ACE_Asynch_Pseudo_Task ()
virtual ~ACE_Asynch_Pseudo_Task ()
int start (void)
int stop (void)
int register_io_handler (ACE_HANDLE handle, ACE_Event_Handler *handler, ACE_Reactor_Mask mask, int flg_suspend)
int remove_io_handler (ACE_HANDLE handle)
int remove_io_handler (ACE_Handle_Set &set)
int resume_io_handler (ACE_HANDLE handle)
int suspend_io_handler (ACE_HANDLE handle)

Protected Member Functions

virtual int svc (void)
 Run by a daemon thread to handle deferred processing.

Protected Attributes

ACE_Select_Reactor select_reactor_
 Should be initialized before reactor_.
ACE_Reactor reactor_

Detailed Description

Definition at line 41 of file Asynch_Pseudo_Task.h.


Constructor & Destructor Documentation

ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task (  ) 

Definition at line 12 of file Asynch_Pseudo_Task.cpp.

  : select_reactor_ (),               // should be initialized before reactor_
    reactor_ (&select_reactor_, 0)    // don't delete implementation
{
}

ACE_Asynch_Pseudo_Task::~ACE_Asynch_Pseudo_Task (  )  [virtual]

Definition at line 18 of file Asynch_Pseudo_Task.cpp.

{
  this->stop ();
}


Member Function Documentation

int ACE_Asynch_Pseudo_Task::register_io_handler ( ACE_HANDLE  handle,
ACE_Event_Handler handler,
ACE_Reactor_Mask  mask,
int  flg_suspend 
)

Definition at line 75 of file Asynch_Pseudo_Task.cpp.

{
  // Register the handler with the reactor.
  if (-1 == this->reactor_.register_handler (handle, handler, mask))
    return -1;

  if (flg_suspend == 0)
    return 0;

  // Suspend the handle now. Enable only when the accept is issued
  // by the application.
  if (this->reactor_.suspend_handler (handle) == -1)
    {
      ACE_ERROR
        ((LM_ERROR,
          ACE_TEXT ("%N:%l:%p\n"),
          ACE_TEXT ("register_io_handler (suspended)")));
      this->reactor_.remove_handler (handle, ACE_Event_Handler::ALL_EVENTS_MASK
                                     | ACE_Event_Handler::DONT_CALL);
      return -1;
    }

  return 0;
}

int ACE_Asynch_Pseudo_Task::remove_io_handler ( ACE_HANDLE  handle  ) 
int ACE_Asynch_Pseudo_Task::remove_io_handler ( ACE_Handle_Set set  ) 
int ACE_Asynch_Pseudo_Task::resume_io_handler ( ACE_HANDLE  handle  ) 

Definition at line 125 of file Asynch_Pseudo_Task.cpp.

{
  return this->reactor_.resume_handler (handle);
}

int ACE_Asynch_Pseudo_Task::start ( void   ) 

Definition at line 24 of file Asynch_Pseudo_Task.cpp.

{
  if (this->reactor_.initialized () == 0)
    ACE_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("%N:%l:%p\n"),
                       ACE_TEXT ("start reactor is not initialized")),
                       -1);

  return this->activate () == -1 ? -1 : 0;   // If started, return 0
}

int ACE_Asynch_Pseudo_Task::stop ( void   ) 

Definition at line 36 of file Asynch_Pseudo_Task.cpp.

{
  if (this->thr_count () == 0)  // already stopped
    return 0;

  if (this->reactor_.end_reactor_event_loop () == -1)
    return -1;

  this->wait ();
  this->reactor_.close ();
  return 0;
}

int ACE_Asynch_Pseudo_Task::suspend_io_handler ( ACE_HANDLE  handle  ) 

Definition at line 119 of file Asynch_Pseudo_Task.cpp.

{
  return this->reactor_.suspend_handler (handle);
}

int ACE_Asynch_Pseudo_Task::svc ( void   )  [protected, virtual]

Run by a daemon thread to handle deferred processing.

Reimplemented from ACE_Task_Base.

Definition at line 50 of file Asynch_Pseudo_Task.cpp.

{
#if !defined (ACE_WIN32)

  sigset_t RT_signals;

  sigemptyset (&RT_signals);
  for (int si = ACE_SIGRTMIN; si <= ACE_SIGRTMAX; si++)
    sigaddset (&RT_signals, si);

  if (ACE_OS::pthread_sigmask (SIG_BLOCK, &RT_signals, 0) != 0)
    ACE_ERROR ((LM_ERROR,
                ACE_TEXT ("Error:(%P | %t):%p\n"),
                ACE_TEXT ("pthread_sigmask")));
#endif

  reactor_.owner (ACE_Thread::self ());
  reactor_.run_reactor_event_loop ();

  return 0;
}


Member Data Documentation

Definition at line 66 of file Asynch_Pseudo_Task.h.

Should be initialized before reactor_.

Definition at line 64 of file Asynch_Pseudo_Task.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines