diff options
| author | Andrew Stitcher <astitcher@apache.org> | 2009-05-04 15:55:21 +0000 |
|---|---|---|
| committer | Andrew Stitcher <astitcher@apache.org> | 2009-05-04 15:55:21 +0000 |
| commit | 564d179640cf49feeb8ff84133f892499afb0e65 (patch) | |
| tree | d6fb4c2f2c789379937c2b622772cea2aed69e1d /cpp/src/qpid/sys/windows | |
| parent | c912884c11debf57e8c154fba7dbbcae8ea34d90 (diff) | |
| download | qpid-python-564d179640cf49feeb8ff84133f892499afb0e65.tar.gz | |
Refactored the DispatchHandle/Poller code to remove a long standing
set of race conditions.
- Changed Poller naming for better clarity with
new semantics.
- Changed Poller semantics to avoid DispatchHandle
keeping so much state
- Changed Poller so that it will never re-enable a
Handle until Poller::wait is called again on the same thread
that returned the Handle.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@771338 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys/windows')
| -rw-r--r-- | cpp/src/qpid/sys/windows/AsynchIO.cpp | 8 | ||||
| -rwxr-xr-x | cpp/src/qpid/sys/windows/IocpPoller.cpp | 8 | ||||
| -rw-r--r-- | cpp/src/qpid/sys/windows/PollableCondition.cpp | 6 |
3 files changed, 11 insertions, 11 deletions
diff --git a/cpp/src/qpid/sys/windows/AsynchIO.cpp b/cpp/src/qpid/sys/windows/AsynchIO.cpp index 0a3c36452c..88be5d7634 100644 --- a/cpp/src/qpid/sys/windows/AsynchIO.cpp +++ b/cpp/src/qpid/sys/windows/AsynchIO.cpp @@ -146,7 +146,7 @@ AsynchAcceptorPrivate::~AsynchAcceptorPrivate(void) { } void AsynchAcceptorPrivate::start(Poller::shared_ptr poller) { - poller->addFd(PollerHandle(socket), Poller::INPUT); + poller->monitorHandle(PollerHandle(socket), Poller::INPUT); restart (); } @@ -426,7 +426,7 @@ void AsynchIO::queueForDeletion() { void AsynchIO::start(Poller::shared_ptr poller0) { poller = poller0; - poller->addFd(PollerHandle(socket), Poller::INPUT); + poller->monitorHandle(PollerHandle(socket), Poller::INPUT); if (writeQueue.size() > 0) // Already have data queued for write notifyPendingWrite(); startReading(); @@ -471,7 +471,7 @@ void AsynchIO::notifyPendingWrite() { boost::bind(&AsynchIO::completion, this, _1)); IOHandle h(hp); PollerHandle ph(h); - poller->addFd(ph, Poller::OUTPUT); + poller->monitorHandle(ph, Poller::OUTPUT); } void AsynchIO::queueWriteClose() { @@ -559,7 +559,7 @@ void AsynchIO::requestCallback(RequestCallback callback) { callback); IOHandle h(hp); PollerHandle ph(h); - poller->addFd(ph, Poller::INPUT); + poller->monitorHandle(ph, Poller::INPUT); } /** diff --git a/cpp/src/qpid/sys/windows/IocpPoller.cpp b/cpp/src/qpid/sys/windows/IocpPoller.cpp index 3760c26c00..467ef8facb 100755 --- a/cpp/src/qpid/sys/windows/IocpPoller.cpp +++ b/cpp/src/qpid/sys/windows/IocpPoller.cpp @@ -122,7 +122,7 @@ void Poller::run() { } while (true); } -void Poller::addFd(PollerHandle& handle, Direction dir) { +void Poller::monitorHandle(PollerHandle& handle, Direction dir) { HANDLE h = (HANDLE)(handle.impl->fd); if (h != INVALID_HANDLE_VALUE) { HANDLE iocpHandle = ::CreateIoCompletionPort (h, impl->iocp, 0, 0); @@ -146,9 +146,9 @@ void Poller::addFd(PollerHandle& handle, Direction dir) { } // All no-ops... -void Poller::delFd(PollerHandle& handle) {} -void Poller::modFd(PollerHandle& handle, Direction dir) {} -void Poller::rearmFd(PollerHandle& handle) {} +void Poller::unmonitorHandle(PollerHandle& handle, Direction dir) {} +void Poller::registerHandle(PollerHandle& handle) {} +void Poller::unregisterHandle(PollerHandle& handle) {} Poller::Event Poller::wait(Duration timeout) { DWORD timeoutMs = 0; diff --git a/cpp/src/qpid/sys/windows/PollableCondition.cpp b/cpp/src/qpid/sys/windows/PollableCondition.cpp index ed0f7c3917..82913934d6 100644 --- a/cpp/src/qpid/sys/windows/PollableCondition.cpp +++ b/cpp/src/qpid/sys/windows/PollableCondition.cpp @@ -76,15 +76,15 @@ void PollableConditionPrivate::poke() if (!armed) return; - // addFd will queue a completion for the IOCP; when it's handled, a + // monitorHandle will queue a completion for the IOCP; when it's handled, a // poller thread will call back to dispatch() below. PollerHandle ph(*this); - poller->addFd(ph, Poller::INPUT); + poller->monitorHandle(ph, Poller::INPUT); } void PollableConditionPrivate::dispatch(AsynchIoResult *result) { - delete result; // Poller::addFd() allocates this + delete result; // Poller::monitorHandle() allocates this cb(parent); } |
