diff -u -r Ice-3.5.1.orig/cpp/src/Ice/Selector.cpp Ice-3.5.1/cpp/src/Ice/Selector.cpp --- Ice-3.5.1.orig/cpp/src/Ice/Selector.cpp 2013-10-02 08:33:51.000000000 -0700 +++ Ice-3.5.1/cpp/src/Ice/Selector.cpp 2014-03-11 10:14:11.926992200 -0700 @@ -178,11 +178,11 @@ } EventHandler* -Selector::getNextHandler(SocketOperation& status, int timeout) +Selector::getNextHandler(SocketOperation& status, DWORD& count, int& error, int timeout) { ULONG_PTR key; LPOVERLAPPED ol; - DWORD count; + error = 0; if(!GetQueuedCompletionStatus(_handle, &count, &key, &ol, timeout > 0 ? timeout * 1000 : INFINITE)) { @@ -205,16 +205,14 @@ } AsyncInfo* info = static_cast(ol); status = info->status; - info->count = SOCKET_ERROR; - info->error = WSAGetLastError(); + count = SOCKET_ERROR; + error = WSAGetLastError(); return reinterpret_cast(key); } assert(ol); AsyncInfo* info = static_cast(ol); status = info->status; - info->count = count; - info->error = 0; return reinterpret_cast(key); } diff -u -r Ice-3.5.1.orig/cpp/src/Ice/Selector.h Ice-3.5.1/cpp/src/Ice/Selector.h --- Ice-3.5.1.orig/cpp/src/Ice/Selector.h 2013-10-02 08:33:51.000000000 -0700 +++ Ice-3.5.1/cpp/src/Ice/Selector.h 2014-03-11 10:14:11.958242200 -0700 @@ -92,7 +92,7 @@ void update(EventHandler*, SocketOperation, SocketOperation); void finish(EventHandler*); - EventHandler* getNextHandler(SocketOperation&, int); + EventHandler* getNextHandler(SocketOperation&, DWORD&, int&, int); HANDLE getIOCPHandle() { return _handle; } diff -u -r Ice-3.5.1.orig/cpp/src/Ice/ThreadPool.cpp Ice-3.5.1/cpp/src/Ice/ThreadPool.cpp --- Ice-3.5.1.orig/cpp/src/Ice/ThreadPool.cpp 2013-10-02 08:33:51.000000000 -0700 +++ Ice-3.5.1/cpp/src/Ice/ThreadPool.cpp 2014-03-11 10:14:11.958242200 -0700 @@ -774,7 +774,8 @@ try { current._ioCompleted = false; - current._handler = _selector.getNextHandler(current.operation, _threadIdleTime); + current._handler = _selector.getNextHandler(current.operation, current._count, current._error, + _threadIdleTime); } catch(const SelectorTimeoutException&) { @@ -819,7 +820,8 @@ try { - current._handler = _selector.getNextHandler(current.operation, _serverIdleTime); + current._handler = _selector.getNextHandler(current.operation, current._count, current._error, + _serverIdleTime); } catch(const SelectorTimeoutException&) { @@ -967,6 +969,11 @@ assert(!(current._handler->_ready & current.operation)); current._handler->_ready = static_cast(current._handler->_ready | current.operation); current._handler->_started = static_cast(current._handler->_started & ~current.operation); + + AsyncInfo* info = current._handler->getNativeInfo()->getAsyncInfo(current.operation); + info->count = current._count; + info->error = current._error; + if(!current._handler->finishAsync(current.operation)) // Returns false if the handler is finished. { current._handler->_pending = static_cast(current._handler->_pending & ~current.operation); diff -u -r Ice-3.5.1.orig/cpp/src/Ice/ThreadPool.h Ice-3.5.1/cpp/src/Ice/ThreadPool.h --- Ice-3.5.1.orig/cpp/src/Ice/ThreadPool.h 2013-10-02 08:33:51.000000000 -0700 +++ Ice-3.5.1/cpp/src/Ice/ThreadPool.h 2014-03-11 10:14:11.958242200 -0700 @@ -165,6 +165,9 @@ bool _ioCompleted; #if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) bool _leader; +#else + DWORD _count; + int _error; #endif friend class ThreadPool; };