1 /*++ 2 3 Copyright (c) Microsoft Corporation 4 5 ModuleName: 6 7 MxWorkItemUm.cpp 8 9 Abstract: 10 11 Work item callback thunk implementation for user mode 12 13 We need this thunk to wire the um callback to a mode agnostic work item 14 callback. 15 16 Author: 17 18 19 20 Revision History: 21 22 23 24 --*/ 25 26 #include "Mx.h" 27 28 VOID 29 CALLBACK 30 MxWorkItem::_WorkerThunk ( 31 _Inout_ PTP_CALLBACK_INSTANCE Instance, 32 _Inout_opt_ PVOID Parameter, 33 _Inout_ PTP_WAIT Wait, 34 _In_ TP_WAIT_RESULT WaitResult 35 ) 36 { 37 MdWorkItem workItem = (MdWorkItem) Parameter; 38 39 UNREFERENCED_PARAMETER(Instance); 40 UNREFERENCED_PARAMETER(Wait); 41 UNREFERENCED_PARAMETER(WaitResult); 42 43 (*workItem->Callback)( 44 workItem->DeviceObject, 45 workItem->Context 46 ); 47 48 return; 49 } 50 51 VOID 52 MxWorkItem::WaitForCallbacksToComplete( 53 VOID 54 ) 55 { 56 Mx::MxAssert(NULL != m_WorkItem->WaitBlock); 57 58 // 59 // Wait for outstanding callbacks to complete. 60 // 61 WaitForThreadpoolWaitCallbacks(m_WorkItem->WaitBlock, 62 FALSE // donot cancel pending waits 63 ); 64 65 } 66 67