Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_POSIX_CB_Proactor Class Reference

Implementation of Callback-based Proactor };. More...

#include <POSIX_CB_Proactor.h>

Inheritance diagram for ACE_POSIX_CB_Proactor:

Inheritance graph
[legend]
Collaboration diagram for ACE_POSIX_CB_Proactor:

Collaboration graph
[legend]
List of all members.

Public Methods

virtual Proactor_Type get_impl_type (void)
virtual ~ACE_POSIX_CB_Proactor (void)
 Destructor. More...

 ACE_POSIX_CB_Proactor (size_t max_aio_operations=ACE_AIO_DEFAULT_SIZE)
 Constructor defines max number asynchronous operations that can be started at the same time. More...


Protected Methods

virtual int handle_events (ACE_Time_Value &wait_time)
virtual int handle_events (void)
virtual ssize_t allocate_aio_slot (ACE_POSIX_Asynch_Result *result)
 Find free slot to store result and aiocb pointer. More...

virtual int notify_completion (int sig_num)
 Notify queue of "post_completed" ACE_POSIX_Asynch_Results called from post_completion method. More...

int handle_events_i (u_long milli_seconds)

Static Protected Methods

void aio_completion_func (sigval_t cb_data)

Protected Attributes

ACE_SYNCH_SEMAPHORE sema_
 semaphore variable to notify used to wait the first AIO start. More...


Detailed Description

Implementation of Callback-based Proactor };.

Definition at line 32 of file POSIX_CB_Proactor.h.


Constructor & Destructor Documentation

ACE_POSIX_CB_Proactor::~ACE_POSIX_CB_Proactor void    [virtual]
 

Destructor.

Definition at line 29 of file POSIX_CB_Proactor.cpp.

References ACE_POSIX_AIOCB_Proactor::close.

00030 {
00031   this->close ();
00032 }

ACE_POSIX_CB_Proactor::ACE_POSIX_CB_Proactor size_t    max_aio_operations = ACE_AIO_DEFAULT_SIZE
 

Constructor defines max number asynchronous operations that can be started at the same time.

Definition at line 17 of file POSIX_CB_Proactor.cpp.

References ACE_POSIX_Proactor::get_asynch_pseudo_task, and ACE_Asynch_Pseudo_Task::start.

00018   : ACE_POSIX_AIOCB_Proactor (max_aio_operations, 
00019                               ACE_POSIX_Proactor::PROACTOR_CB),
00020     sema_ (0)
00021 {
00022   // we should start pseudo-asynchronous accept task
00023   // one per all future acceptors
00024 
00025   this->get_asynch_pseudo_task ().start ();
00026 }


Member Function Documentation

void ACE_POSIX_CB_Proactor::aio_completion_func sigval_t    cb_data [static, protected]
 

Definition at line 34 of file POSIX_CB_Proactor.cpp.

References notify_completion.

Referenced by allocate_aio_slot.

00035 {
00036 #if defined (__FreeBSD__)
00037   ACE_POSIX_CB_Proactor * impl = ACE_static_cast (ACE_POSIX_CB_Proactor *, cb_data.sigval_ptr);
00038 #else
00039   ACE_POSIX_CB_Proactor * impl = ACE_static_cast (ACE_POSIX_CB_Proactor *, cb_data.sival_ptr);
00040 #endif
00041 
00042   if ( impl != 0 )
00043     impl->notify_completion (0);
00044 }

ssize_t ACE_POSIX_CB_Proactor::allocate_aio_slot ACE_POSIX_Asynch_Result   result [protected, virtual]
 

Find free slot to store result and aiocb pointer.

Reimplemented from ACE_POSIX_AIOCB_Proactor.

Definition at line 70 of file POSIX_CB_Proactor.cpp.

References aio_completion_func, ACE_POSIX_AIOCB_Proactor::allocate_aio_slot, and ssize_t.

00071 {
00072   ssize_t slot = ACE_POSIX_AIOCB_Proactor::allocate_aio_slot (result);
00073   if (slot == -1)
00074     return -1;
00075 
00076   // setup OS notification methods for this aio
00077   // store index!!, not pointer in signal info
00078   // need to figure out correct thing to do here when we are not on SGI
00079 #if defined(__sgi)
00080   result->aio_sigevent.sigev_notify = SIGEV_CALLBACK;
00081   result->aio_sigevent.sigev_func   = aio_completion_func ;
00082 #else
00083   result->aio_sigevent.sigev_notify = SIGEV_SIGNAL;
00084 #endif /* __sgi */
00085 
00086 #if defined (__FreeBSD__)
00087   result->aio_sigevent.sigev_value.sigval_ptr = this ;
00088 #else
00089   result->aio_sigevent.sigev_value.sival_ptr = this ;
00090 #endif /* __FreeBSD__ */
00091 
00092   return slot;
00093 }

virtual Proactor_Type ACE_POSIX_CB_Proactor::get_impl_type void    [virtual]
 

Reimplemented from ACE_POSIX_AIOCB_Proactor.

int ACE_POSIX_CB_Proactor::handle_events void    [protected, virtual]
 

Block indefinitely until at least one event is dispatched. Dispatch a single set of events. If <wait_time> elapses before any events occur, return 0. Return 1 on success i.e., when a completion is dispatched, non-zero (-1) on errors and errno is set accordingly.

Reimplemented from ACE_POSIX_AIOCB_Proactor.

Definition at line 55 of file POSIX_CB_Proactor.cpp.

References ACE_INFINITE, and handle_events_i.

00056 {
00057   return this->handle_events_i (ACE_INFINITE);
00058 }

int ACE_POSIX_CB_Proactor::handle_events ACE_Time_Value   wait_time [protected, virtual]
 

Dispatch a single set of events. If <wait_time> elapses before any events occur, return 0. Return 1 on success i.e., when a completion is dispatched, non-zero (-1) on errors and errno is set accordingly.

Reimplemented from ACE_POSIX_AIOCB_Proactor.

Definition at line 47 of file POSIX_CB_Proactor.cpp.

References handle_events_i, and ACE_Time_Value::msec.

00048 {
00049   // Decrement <wait_time> with the amount of time spent in the method
00050   ACE_Countdown_Time countdown (&wait_time);
00051   return this->handle_events_i (wait_time.msec ());
00052 }

int ACE_POSIX_CB_Proactor::handle_events_i u_long    milli_seconds [protected]
 

Dispatch a single set of events. If <milli_seconds> elapses before any events occur, return 0. Return 1 if a completion is dispatched. Return -1 on errors.

Reimplemented from ACE_POSIX_AIOCB_Proactor.

Referenced by handle_events.

int ACE_POSIX_CB_Proactor::notify_completion int    sig_num [protected, virtual]
 

Notify queue of "post_completed" ACE_POSIX_Asynch_Results called from post_completion method.

Reimplemented from ACE_POSIX_AIOCB_Proactor.

Definition at line 61 of file POSIX_CB_Proactor.cpp.

References sema_.

Referenced by aio_completion_func.

00062 {
00063   ACE_UNUSED_ARG (sig_num);
00064 
00065   return this->sema_.release();
00066 }


Member Data Documentation

ACE_SYNCH_SEMAPHORE ACE_POSIX_CB_Proactor::sema_ [protected]
 

semaphore variable to notify used to wait the first AIO start.

Definition at line 82 of file POSIX_CB_Proactor.h.

Referenced by notify_completion.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:54:03 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002