ReactOS 0.4.15-dev-8408-g466a198
FxInterruptWaitblock Class Reference

#include <fxinterruptthreadpoolum.hpp>

Inheritance diagram for FxInterruptWaitblock:
Collaboration diagram for FxInterruptWaitblock:

Public Member Functions

 FxInterruptWaitblock (PFX_DRIVER_GLOBALS FxDriverGlobals)
 
 ~FxInterruptWaitblock ()
 
VOID CloseThreadpoolWait (VOID)
 
VOID SetThreadpoolWait (VOID)
 
VOID ClearThreadpoolWait (VOID)
 
VOID WaitForOutstandingCallbackToComplete (VOID)
 
HANDLE GetEventHandle (VOID)
 
VOID ResetEvent (VOID)
 

Static Public Member Functions

static HRESULT _CreateAndInit (_In_ FxInterruptThreadpool *Threadpool, _In_ FxInterrupt *Interrupt, _In_ PTP_WAIT_CALLBACK WaitCallback, _Out_ FxInterruptWaitblock **Waitblock)
 

Private Member Functions

HRESULT Initialize (__in FxInterruptThreadpool *Threadpool, __in FxInterrupt *Interrupt, __in PTP_WAIT_CALLBACK WaitCallback)
 
- Private Member Functions inherited from FxGlobalsStump
 FxGlobalsStump (__in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
PFX_DRIVER_GLOBALS GetDriverGlobals (VOID)
 
- Private Member Functions inherited from FxStump
PVOID operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
PVOID operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in POOL_TYPE PoolType)
 
VOID operator delete (__in PVOID pointer)
 
PVOID operator new[] (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
VOID operator delete[] (__in PVOID pointer)
 
 FxStump (VOID)
 

Private Attributes

PTP_WAIT m_Wait
 
HANDLE m_Event
 

Detailed Description

Definition at line 94 of file fxinterruptthreadpoolum.hpp.

Constructor & Destructor Documentation

◆ FxInterruptWaitblock()

FxInterruptWaitblock::FxInterruptWaitblock ( PFX_DRIVER_GLOBALS  FxDriverGlobals)
inline

Definition at line 128 of file fxinterruptthreadpoolum.hpp.

130 :
131 FxGlobalsStump(FxDriverGlobals),
132 m_Wait(NULL),
134 {
135 }
#define NULL
Definition: types.h:112

◆ ~FxInterruptWaitblock()

FxInterruptWaitblock::~FxInterruptWaitblock ( )

Definition at line 265 of file fxinterruptthreadpoolum.cpp.

268{
269 //
270 // close the thread pool wait structure
271 //
272 if (m_Wait) {
273 //
274 // Make sure no event is registered.
275 //
277
278 //
279 // Wait for all the callbacks to finish.
280 //
282
283 //
284 // close the wait
285 //
287
288 m_Wait = NULL;
289 }
290
291 //
292 // close event handle
293 //
294 if (m_Event) {
296 m_Event = NULL;
297 }
298}
#define CloseHandle
Definition: compat.h:739

Member Function Documentation

◆ _CreateAndInit()

HRESULT FxInterruptWaitblock::_CreateAndInit ( _In_ FxInterruptThreadpool Threadpool,
_In_ FxInterrupt Interrupt,
_In_ PTP_WAIT_CALLBACK  WaitCallback,
_Out_ FxInterruptWaitblock **  Waitblock 
)
static

Definition at line 301 of file fxinterruptthreadpoolum.cpp.

307{
308 HRESULT hr = S_OK;
309 FxInterruptWaitblock* waitblock = NULL;
310 PFX_DRIVER_GLOBALS driverGlobals;
311
312 FX_VERIFY(INTERNAL, CHECK_NOT_NULL(Waitblock));
313 *Waitblock = NULL;
314 driverGlobals = Interrupt->GetDriverGlobals();
315
316 //
317 // create an instance of interrupt wait block
318 //
319 waitblock = new (driverGlobals) FxInterruptWaitblock(driverGlobals);
320 if (waitblock == NULL) {
322 DoTraceLevelMessage(driverGlobals,
324 "Waitblock creation failed %!hresult!", hr);
325 goto exit;
326 }
327
328 hr = waitblock->Initialize(Threadpool,
329 Interrupt,
330 WaitCallback);
331 if (SUCCEEDED(hr)) {
332 *Waitblock = waitblock;
333 }
334 else {
335 DoTraceLevelMessage(driverGlobals,
337 "Waitblock init failed %!hresult!", hr);
338 }
339
340exit:
341
342 if(FAILED(hr) && waitblock != NULL) {
343 delete waitblock;
344 }
345
346 return hr;
347}
HRESULT Initialize(__in FxInterruptThreadpool *Threadpool, __in FxInterrupt *Interrupt, __in PTP_WAIT_CALLBACK WaitCallback)
#define TRACINGPNP
Definition: dbgtrace.h:67
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
FX_VERIFY(INTERNAL, CHECK_NOT_NULL(LoaderInterface->pIWudfHost))
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define exit(n)
Definition: config.h:202
HRESULT hr
Definition: shlfolder.c:183
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFINTERRUPT * Interrupt
Definition: wdfinterrupt.h:379

◆ ClearThreadpoolWait()

VOID FxInterruptWaitblock::ClearThreadpoolWait ( VOID  )
inline

Definition at line 160 of file fxinterruptthreadpoolum.hpp.

163 {
164 //
165 // Passing a NULL handle clears the wait
166 //
168 }

Referenced by ~FxInterruptWaitblock().

◆ CloseThreadpoolWait()

VOID FxInterruptWaitblock::CloseThreadpoolWait ( VOID  )
inline

Definition at line 140 of file fxinterruptthreadpoolum.hpp.

143 {
145 }

Referenced by CloseThreadpoolWait(), and ~FxInterruptWaitblock().

◆ GetEventHandle()

HANDLE FxInterruptWaitblock::GetEventHandle ( VOID  )
inline

Definition at line 179 of file fxinterruptthreadpoolum.hpp.

182 {
183 return m_Event;
184 }

◆ Initialize()

HRESULT FxInterruptWaitblock::Initialize ( __in FxInterruptThreadpool Threadpool,
__in FxInterrupt Interrupt,
__in PTP_WAIT_CALLBACK  WaitCallback 
)
private

Definition at line 350 of file fxinterruptthreadpoolum.cpp.

355{
356 HRESULT hr = S_OK;
357 DWORD error;
358
359 //
360 // create a per-interrupt auto-reset event, non-signalled to begin with.
361 //
363 NULL, // LPSECURITY_ATTRIBUTES lpEventAttributes,
364 FALSE, // BOOL bManualReset,
365 FALSE, // BOOL bInitialState,
366 NULL // LPCTSTR lpName
367 );
368
369 if (m_Event == NULL) {
374 "Event creation failed for FxInterrupt object"
375 " %!winerr!", error);
376 goto exit;
377 }
378
379 //
380 // create a per-interrupt thread pool wait structure. This wait structure is
381 // needed to associate an event-based wait callback with threadpool.
382 //
383 m_Wait = Threadpool->CreateThreadpoolWait(WaitCallback,
384 Interrupt);
385 if (m_Wait == NULL) {
390 "Event creation failed for FxInterrupt object"
391 " %!winerr!", error);
392 goto exit;
393 }
394
395exit:
396
397 return hr;
398}
#define FALSE
Definition: types.h:117
unsigned long DWORD
Definition: ntddk_ex.h:95
#define error(str)
Definition: mkdosfs.c:1605
PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxstump.hpp:98
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define CreateEvent
Definition: winbase.h:3748
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

Referenced by _CreateAndInit().

◆ ResetEvent()

VOID FxInterruptWaitblock::ResetEvent ( VOID  )
inline

Definition at line 187 of file fxinterruptthreadpoolum.hpp.

190 {
192 }

Referenced by ResetEvent().

◆ SetThreadpoolWait()

VOID FxInterruptWaitblock::SetThreadpoolWait ( VOID  )
inline

Definition at line 148 of file fxinterruptthreadpoolum.hpp.

151 {
152 //
153 // associates event with wait block and queues it
154 // to thread pool queue.
155 //
157 }

Referenced by ClearThreadpoolWait(), and SetThreadpoolWait().

◆ WaitForOutstandingCallbackToComplete()

VOID FxInterruptWaitblock::WaitForOutstandingCallbackToComplete ( VOID  )
inline

Definition at line 171 of file fxinterruptthreadpoolum.hpp.

174 {
175 ::WaitForThreadpoolWaitCallbacks(m_Wait, FALSE);
176 }

Referenced by ~FxInterruptWaitblock().

Member Data Documentation

◆ m_Event

HANDLE FxInterruptWaitblock::m_Event
private

◆ m_Wait


The documentation for this class was generated from the following files: