diff options
author | harrison <harrison@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-12-18 21:23:31 +0000 |
---|---|---|
committer | harrison <harrison@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-12-18 21:23:31 +0000 |
commit | d7f484388a4bb063cdc67599194ca8cd8bb27242 (patch) | |
tree | 3b8f2de50baabac4b57d07d2f83565f39014ddfc /ace/Proactor.cpp | |
parent | eff083989875902a8a3214b3e4c3d0db27c7d137 (diff) | |
download | ATCD-d7f484388a4bb063cdc67599194ca8cd8bb27242.tar.gz |
Fixed an itty little bug.
Diffstat (limited to 'ace/Proactor.cpp')
-rw-r--r-- | ace/Proactor.cpp | 54 |
1 files changed, 19 insertions, 35 deletions
diff --git a/ace/Proactor.cpp b/ace/Proactor.cpp index b2c9ed505d6..4e641288f7d 100644 --- a/ace/Proactor.cpp +++ b/ace/Proactor.cpp @@ -156,7 +156,7 @@ ACE_Overlapped_IO::operator ACE_OVERLAPPED * (void) } ACE_Proactor::ACE_Proactor (size_t number_of_threads, ACE_Timer_Queue *tq) - : completion_port_ (ACE_INVALID_HANDLE), + : completion_port_ (0), // This *MUST* be 0, *NOT* ACE_INVALID_HANDLE!!!! number_of_threads_ (number_of_threads), timer_queue_ (tq) { @@ -176,7 +176,7 @@ ACE_Proactor::~ACE_Proactor (void) int ACE_Proactor::close (void) { - if (this->completion_port_ != ACE_INVALID_HANDLE) + if (this->completion_port_ != 0) ACE_OS::close (this->completion_port_); // @@ Should we call shared_event_.remove ()? @@ -190,10 +190,6 @@ ACE_Proactor::handle_signal (int, siginfo_t *, ucontext_t *) ACE_Time_Value timeout (0, 0); - // Reset the handle to a non-signaled state. - if (shared_event_.reset () == 0) - ACE_ERROR_RETURN ((LM_ERROR, "ResetEvent failed.\n"), -1); - // Perform a non-blocking "poll" for all the I/O events that have // completed in the I/O completion queue. @@ -240,36 +236,24 @@ ACE_Proactor::handle_events (ACE_Time_Value *how_long) ACE_HANDLE io_handle = ACE_INVALID_HANDLE; int timeout = how_long == 0 ? INFINITE : how_long->msec (); - // If completion_port_ is not set, then we can't wait in - // GetQueueCompletionStatus. This approach is a total hack; there - // should be a better way. The drawback to this sleep is that - // there's no way to wake up the sleep to register new events. - if (completion_port_ == ACE_INVALID_HANDLE) - { - ACE_OS::sleep (timeout); - error = ACE_TIMEOUT_OCCURRED; - } - else - { - // When we port this to use Posix async I/O, this call will be - // replace will a generic ACE_OS call. - BOOL result; + // When we port this to use Posix async I/O, this call will be + // replace will a generic ACE_OS call. + BOOL result; - result = ::GetQueuedCompletionStatus (completion_port_, - &bytes_transferred, - (u_long *) &io_handle, - (ACE_OVERLAPPED **) &overlapped, - timeout); - - // Check for a failed dequeue. This can happen either because - // of problems with the IO completion port (in which case - // overlapped == 0) or due to problems with the completion - // operation (in which case overlapped != 0). In either case, - // we'll stash the error value so that we can update errno - // appropriate later on. - if (result == FALSE) - error = ::GetLastError (); - } + result = ::GetQueuedCompletionStatus (completion_port_, + &bytes_transferred, + (u_long *) &io_handle, + (ACE_OVERLAPPED **) &overlapped, + timeout); + + // Check for a failed dequeue. This can happen either because + // of problems with the IO completion port (in which case + // overlapped == 0) or due to problems with the completion + // operation (in which case overlapped != 0). In either case, + // we'll stash the error value so that we can update errno + // appropriate later on. + if (result == FALSE) + error = ::GetLastError (); // Check for any timers that can be handled before we dispatch the // dequeued event. Note that this is done irrespective of whether |