winverbs/winmad: allow clients to use IOCPs
authorshefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 24 Feb 2009 23:17:49 +0000 (23:17 +0000)
committershefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 24 Feb 2009 23:17:49 +0000 (23:17 +0000)
This patch allows clients to use IOCPs.  It sets the lower bit of the event used for synchronous IOCTLs to prevent their completion from being reported to the IOCP.

Signed-off-by: Fab Tillier <ftillier@microsoft.com>
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1986 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/winmad/user/wm_provider.cpp
core/winverbs/user/wv_base.cpp

index e5f99ca..2086af7 100644 (file)
@@ -50,9 +50,12 @@ Init(void)
 {\r
        m_OverlapRead.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);\r
        m_OverlapWrite.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);\r
+       if (m_OverlapRead.hEvent == NULL || m_OverlapWrite.hEvent == NULL)\r
+               return E_OUTOFMEMORY;\r
 \r
-       return (m_OverlapRead.hEvent != NULL && m_OverlapWrite.hEvent != NULL) ?\r
-                       NOERROR : E_OUTOFMEMORY;\r
+       m_OverlapRead.hEvent = (HANDLE) ((ULONG_PTR) m_OverlapRead.hEvent | 1);\r
+       m_OverlapWrite.hEvent = (HANDLE) ((ULONG_PTR) m_OverlapWrite.hEvent | 1);\r
+       return NOERROR;\r
 }\r
 \r
 CWMProvider::~CWMProvider()\r
index d47fd6f..0bdda4c 100644 (file)
@@ -52,7 +52,11 @@ STDMETHODIMP CWVBase::
 Init(void)\r
 {\r
        m_Overlap.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);\r
-       return (m_Overlap.hEvent != NULL) ? WV_SUCCESS : WV_INSUFFICIENT_RESOURCES;\r
+       if (m_Overlap.hEvent == NULL)\r
+               return WV_INSUFFICIENT_RESOURCES;\r
+\r
+       m_Overlap.hEvent = (HANDLE) ((ULONG_PTR) m_Overlap.hEvent | 1);\r
+       return WV_SUCCESS;\r
 }\r
 \r
 STDMETHODIMP_(ULONG) CWVBase::\r