ReactOS  0.4.15-dev-3165-gdf6fff7
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),
133  m_Event(NULL)
134  {
135  }
FxGlobalsStump(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
Definition: fxstump.hpp:90
#define NULL
Definition: types.h:112

Referenced by _CreateAndInit().

◆ ~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:598
#define NULL
Definition: types.h:112

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) {
321  hr = E_OUTOFMEMORY;
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 
340 exit:
341 
342  if(FAILED(hr) && waitblock != NULL) {
343  delete waitblock;
344  }
345 
346  return hr;
347 }
HRESULT hr
Definition: shlfolder.c:183
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFINTERRUPT * Interrupt
Definition: wdfinterrupt.h:372
FxInterruptWaitblock(PFX_DRIVER_GLOBALS FxDriverGlobals)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
if SUCCEEDED(hr)
HRESULT Initialize(__in FxInterruptThreadpool *Threadpool, __in FxInterrupt *Interrupt, __in PTP_WAIT_CALLBACK WaitCallback)
FX_VERIFY(INTERNAL, CHECK_NOT_NULL(LoaderInterface->pIWudfHost))
LONG HRESULT
Definition: typedefs.h:79
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACINGPNP
Definition: dbgtrace.h:67
#define S_OK
Definition: intsafe.h:52
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
void exit(int exitcode)
Definition: _exit.c:33

◆ 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  }
#define NULL
Definition: types.h:112

Referenced by ~FxInterruptWaitblock().

◆ CloseThreadpoolWait()

VOID FxInterruptWaitblock::CloseThreadpoolWait ( VOID  )
inline

Definition at line 140 of file fxinterruptthreadpoolum.hpp.

Referenced by ~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) {
370  error = GetLastError();
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) {
386  error = GetLastError();
390  "Event creation failed for FxInterrupt object"
391  " %!winerr!", error);
392  goto exit;
393  }
394 
395 exit:
396 
397  return hr;
398 }
#define CreateEvent
Definition: winbase.h:3604
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
#define error(str)
Definition: mkdosfs.c:1605
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFINTERRUPT * Interrupt
Definition: wdfinterrupt.h:372
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define FALSE
Definition: types.h:117
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACINGPNP
Definition: dbgtrace.h:67
#define S_OK
Definition: intsafe.h:52
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
void exit(int exitcode)
Definition: _exit.c:33
PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxstump.hpp:98

Referenced by _CreateAndInit().

◆ ResetEvent()

VOID FxInterruptWaitblock::ResetEvent ( VOID  )
inline

Definition at line 187 of file fxinterruptthreadpoolum.hpp.

◆ 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  }
#define NULL
Definition: types.h:112

Referenced by ClearThreadpoolWait().

◆ WaitForOutstandingCallbackToComplete()

VOID FxInterruptWaitblock::WaitForOutstandingCallbackToComplete ( VOID  )
inline

Definition at line 171 of file fxinterruptthreadpoolum.hpp.

174  {
175  ::WaitForThreadpoolWaitCallbacks(m_Wait, FALSE);
176  }
#define FALSE
Definition: types.h:117

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: