Inheritance diagram for ACE_AIOCB_Notify_Pipe_Manager:
Public Member Functions | |
ACE_AIOCB_Notify_Pipe_Manager (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor) | |
virtual | ~ACE_AIOCB_Notify_Pipe_Manager (void) |
Destructor. | |
int | notify () |
Send the result pointer through the notification pipe. | |
virtual void | handle_read_stream (const ACE_Asynch_Read_Stream::Result &result) |
Private Member Functions | |
ACE_AIOCB_Notify_Pipe_Manager (void) | |
Default constructor. Shouldnt be called. | |
Private Attributes | |
ACE_POSIX_AIOCB_Proactor * | posix_aiocb_proactor_ |
The implementation proactor class. | |
ACE_Message_Block | message_block_ |
Message block to get ACE_POSIX_Asynch_Result pointer from the pipe. | |
ACE_Pipe | pipe_ |
ACE_POSIX_Asynch_Read_Stream | read_stream_ |
To do asynch_read on the pipe. |
This class acts as the Handler for the operations issued on the notify pipe. This class is very useful in implementing operation class for the . This is also useful for implementing for .
class issues a on the pipe, using this class as the Handler. <POSIX_Asynch_Result *>'s are sent through the notify pipe. When <POSIX_Asynch_Result *>'s show up on the notify pipe, the dispatches the completion of the and calls the of this class. This class calls on the <POSIX_Asynch_Result *> and thus calls the application handler. Handling the MessageBlock: We give this message block to read the result pointer through the notify pipe. We expect that to read 4 bytes from the notify pipe, for each call. Before giving this message block to another , we update and put it in its initial position.
Definition at line 629 of file POSIX_Proactor.cpp.
|
Constructor. You need the posix proactor because you need to call Definition at line 664 of file POSIX_Proactor.cpp. References ACE_ERROR, ACE_NONBLOCK, LM_ERROR, ACE_POSIX_Asynch_Operation::open(), ACE_Pipe::open(), pipe_, posix_aiocb_proactor_, ACE_POSIX_Asynch_Read_Stream::read(), ACE_Pipe::read_handle(), read_stream_, ACE::set_flags(), and ACE_POSIX_AIOCB_Proactor::set_notify_handle().
00665 : posix_aiocb_proactor_ (posix_aiocb_proactor), 00666 message_block_ (sizeof (2)), 00667 read_stream_ (posix_aiocb_proactor) 00668 { 00669 // Open the pipe. 00670 this->pipe_.open (); 00671 00672 // Set write side in NONBLOCK mode 00673 ACE::set_flags (this->pipe_.write_handle (), ACE_NONBLOCK); 00674 00675 // Set read side in NONBLOCK mode 00676 ACE::set_flags (this->pipe_.read_handle (), ACE_NONBLOCK); 00677 00678 // Let AIOCB_Proactor know about our handle 00679 posix_aiocb_proactor_->set_notify_handle (this->pipe_.read_handle ()); 00680 00681 // Open the read stream. 00682 if (this->read_stream_.open (this->proxy (), 00683 this->pipe_.read_handle (), 00684 0, // Completion Key 00685 0) // Proactor 00686 == -1) 00687 ACE_ERROR ((LM_ERROR, 00688 "%N:%l:%p\n", 00689 "ACE_AIOCB_Notify_Pipe_Manager::ACE_AIOCB_Notify_Pipe_Manager:" 00690 "Open on Read Stream failed")); 00691 00692 // Issue an asynch_read on the read_stream of the notify pipe. 00693 if (this->read_stream_.read (this->message_block_, 00694 1, // enough to read 1 byte 00695 0, // ACT 00696 0) // Priority 00697 == -1) 00698 ACE_ERROR ((LM_ERROR, 00699 "%N:%l:%p\n", 00700 "ACE_AIOCB_Notify_Pipe_Manager::ACE_AIOCB_Notify_Pipe_Manager:" 00701 "Read from pipe failed")); 00702 } |
|
Destructor.
Definition at line 704 of file POSIX_Proactor.cpp. References ACE_POSIX_Asynch_Operation::cancel(), ACE_OS::closesocket(), pipe_, ACE_Pipe::read_handle(), read_stream_, and ACE_Pipe::write_handle().
00705 { 00706 // 1. try to cancel pending aio 00707 this->read_stream_.cancel (); 00708 00709 // 2. close both handles 00710 // Destuctor of ACE_Pipe does not close handles. 00711 // We can not use ACE_Pipe::close() as it 00712 // closes read_handle and than write_handle. 00713 // In some systems close() may wait for 00714 // completion for all asynch. pending requests. 00715 // So we should close write_handle firstly 00716 // to force read completion ( if 1. does not help ) 00717 // and then read_handle and not vice versa 00718 00719 ACE_HANDLE h = this->pipe_.write_handle (); 00720 if (h != ACE_INVALID_HANDLE) 00721 ACE_OS::closesocket (h); 00722 00723 h = this->pipe_.read_handle (); 00724 if ( h != ACE_INVALID_HANDLE) 00725 ACE_OS::closesocket (h); 00726 00727 } |
|
Default constructor. Shouldnt be called.
|
|
This is the call back method when from the pipe is complete. Reimplemented from ACE_Handler. Definition at line 756 of file POSIX_Proactor.cpp. References ACE_ERROR, ACE_LIB_TEXT, and LM_ERROR.
00757 { 00758 // 1. Start new read to avoid pipe overflow 00759 00760 // Set the message block properly. Put the <wr_ptr> back in the 00761 // initial position. 00762 if (this->message_block_.length () > 0) 00763 this->message_block_.wr_ptr (this->message_block_.rd_ptr ()); 00764 00765 // One accept has completed. Issue a read to handle any 00766 // <post_completion>s in the future. 00767 if (-1 == this->read_stream_.read (this->message_block_, 00768 1, // enough to read 1 byte 00769 0, // ACT 00770 0)) // Priority 00771 ACE_ERROR ((LM_ERROR, 00772 ACE_LIB_TEXT ("%N:%l:(%P | %t):%p\n"), 00773 ACE_LIB_TEXT ("ACE_AIOCB_Notify_Pipe_Manager::handle_read_stream:") 00774 ACE_LIB_TEXT ("Read from pipe failed"))); 00775 00776 00777 // 2. Do the upcalls 00778 // this->posix_aiocb_proactor_->process_result_queue (); 00779 } |
|
Send the result pointer through the notification pipe.
Definition at line 731 of file POSIX_Proactor.cpp. References ACE_ERROR, ACE_LIB_TEXT, EWOULDBLOCK, LM_ERROR, ACE::send(), and ssize_t. Referenced by ACE_POSIX_AIOCB_Proactor::notify_completion().
00732 { 00733 // Send the result pointer through the pipe. 00734 char char_send = 0; 00735 ssize_t ret_val = ACE::send (this->pipe_.write_handle (), 00736 &char_send, 00737 sizeof (char_send)); 00738 00739 if (ret_val < 0) 00740 { 00741 if (errno != EWOULDBLOCK) 00742 #if 0 00743 ACE_ERROR ((LM_ERROR, 00744 ACE_LIB_TEXT ("(%P %t):%p\n"), 00745 ACE_LIB_TEXT ("ACE_AIOCB_Notify_Pipe_Manager::notify") 00746 ACE_LIB_TEXT ("Error:Writing on to notify pipe failed"))); 00747 #endif /* 0 */ 00748 return -1; 00749 } 00750 00751 return 0; 00752 } |
|
Message block to get ACE_POSIX_Asynch_Result pointer from the pipe.
Definition at line 651 of file POSIX_Proactor.cpp. |
|
Pipe for the communication between Proactor and the Asynch_Accept/Asynch_Connect and other post_completions Definition at line 655 of file POSIX_Proactor.cpp. Referenced by ACE_AIOCB_Notify_Pipe_Manager(), and ~ACE_AIOCB_Notify_Pipe_Manager(). |
|
The implementation proactor class.
Definition at line 648 of file POSIX_Proactor.cpp. Referenced by ACE_AIOCB_Notify_Pipe_Manager(). |
|
To do asynch_read on the pipe.
Definition at line 658 of file POSIX_Proactor.cpp. Referenced by ACE_AIOCB_Notify_Pipe_Manager(), and ~ACE_AIOCB_Notify_Pipe_Manager(). |