ReactOS  0.4.14-dev-50-g13bb5e2
eventobj.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for eventobj.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

VOID NTAPI KeClearEvent (IN PKEVENT Event)
 
VOID NTAPI KeInitializeEvent (OUT PKEVENT Event, IN EVENT_TYPE Type, IN BOOLEAN State)
 
VOID NTAPI KeInitializeEventPair (IN PKEVENT_PAIR EventPair)
 
LONG NTAPI KePulseEvent (IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
 
LONG NTAPI KeReadStateEvent (IN PKEVENT Event)
 
LONG NTAPI KeResetEvent (IN PKEVENT Event)
 
LONG NTAPI KeSetEvent (IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
 
VOID NTAPI KeSetEventBoostPriority (IN PKEVENT Event, IN PKTHREAD *WaitingThread OPTIONAL)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file eventobj.c.

Function Documentation

◆ KeClearEvent()

VOID NTAPI KeClearEvent ( IN PKEVENT  Event)

Definition at line 22 of file eventobj.c.

23 {
25 
26  /* Reset Signal State */
27  Event->Header.SignalState = FALSE;
28 }
#define ASSERT_EVENT(Object)

Referenced by __brelse(), _Function_class_(), _Requires_lock_held_(), acpi_bus_receive_event(), add_calc_job(), AfdEnumEvents(), CdRomCreateNamedEvent(), CdWaitSync(), ChewCreate(), chunk_lock_range(), DpcRoutine(), DriverIoControl(), EngClearEvent(), ExSwapinWorkerThreads(), Ext2bhReaperThread(), Ext2FcbReaperThread(), Ext2McbReaperThread(), Ext2ReadWriteBlocks(), ExUnregisterCallback(), FatWaitSync(), FFSReadWriteBlocks(), FinishThread(), FreeBT_IoIncrement(), HalpGetFullGeometry(), IdlePong(), InitController(), IoCancelFileOpen(), IopCloseFile(), IopDeleteFile(), IopDeviceFsIoControl(), IopGetSetSecurityObject(), IopMountVolume(), IopQueryDeviceInformation(), IopShutdownBaseFileSystems(), IoSetInformation(), IoShutdownSystem(), KbdHid_Create(), KsQueryInformationFile(), KsQueueWorkItem(), KsReadFile(), KsStreamIo(), KsWriteFile(), lock_volume(), MiDecrementAvailablePages(), MiIncrementAvailablePages(), MiInitializePoolEvents(), MiNotifyMemoryEvents(), MouHid_Create(), MountMgrUnload(), NdisMAllocateMapRegisters(), NdisResetEvent(), NtClearEvent(), NtFlushBuffersFile(), NtLockFile(), NtNotifyChangeDirectoryFile(), NtQueryDirectoryFile(), NtQueryInformationFile(), NtQueryVolumeInformationFile(), NtReadFile(), NtReplyWaitReceivePortEx(), NtSetInformationFile(), NtSetVolumeInformationFile(), NtUnlockFile(), NtWaitForDebugEvent(), NtWriteFile(), pause_balance(), pause_scrub(), RawQueryFsSizeInfo(), read_send_buffer(), ReadBytes(), ReadWritePassive(), Recalibrate(), ResetChangeFlag(), RfsdReadWriteBlocks(), RootHubInitCallbackFunction(), RWDetermineMediaType(), RWSeekToCylinder(), RxCommonWrite(), RxScavengerTimerRoutine(), RxSpinUpRequestsDispatcher(), SermouseDeviceWorker(), StopMotor(), StreamClassStartDevice(), SubmitIdleRequestIrp(), sys_arch_mbox_fetch(), TestEventFunctional(), TestTcpConnect(), TriggerWork(), USBD_RegisterRootHubCallBack(), USBH_ChangeIndication(), USBH_CheckHubIdle(), USBH_SubmitStatusChangeTransfer(), USBHUB_FdoStartDevice(), USBPORT_WorkerThread(), USBSTOR_QueueAddIrp(), VideoPortClearEvent(), wait_for_flush(), WaitForControllerInterrupt(), and xHalIoSetPartitionInformation().

◆ KeInitializeEvent()

VOID NTAPI KeInitializeEvent ( OUT PKEVENT  Event,
IN EVENT_TYPE  Type,
IN BOOLEAN  State 
)

Definition at line 35 of file eventobj.c.

38 {
39  /* Initialize the Dispatcher Header */
40  Event->Header.Type = Type;
41  //Event->Header.Signalling = FALSE; // fails in kmtest
42  Event->Header.Size = sizeof(KEVENT) / sizeof(ULONG);
43  Event->Header.SignalState = State;
44  InitializeListHead(&(Event->Header.WaitListHead));
45 }
Type
Definition: Type.h:6
struct _KEVENT KEVENT
enum State_ State
Definition: pofuncs.h:54
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
unsigned int ULONG
Definition: retypes.h:1

Referenced by KeInitializeEventPair().

◆ KeInitializeEventPair()

VOID NTAPI KeInitializeEventPair ( IN PKEVENT_PAIR  EventPair)

Definition at line 52 of file eventobj.c.

53 {
54  /* Initialize the Event Pair Type and Size */
55  EventPair->Type = EventPairObject;
56  EventPair->Size = sizeof(KEVENT_PAIR);
57 
58  /* Initialize the two Events */
59  KeInitializeEvent(&EventPair->LowEvent, SynchronizationEvent, FALSE);
60  KeInitializeEvent(&EventPair->HighEvent, SynchronizationEvent, FALSE);
61 }
VOID NTAPI KeInitializeEvent(OUT PKEVENT Event, IN EVENT_TYPE Type, IN BOOLEAN State)
Definition: eventobj.c:35
struct _KEVENT_PAIR KEVENT_PAIR

◆ KePulseEvent()

LONG NTAPI KePulseEvent ( IN PKEVENT  Event,
IN KPRIORITY  Increment,
IN BOOLEAN  Wait 
)

Definition at line 68 of file eventobj.c.

71 {
72  KIRQL OldIrql;
77 
78  /* Lock the Dispatcher Database */
80 
81  /* Save the Old State */
82  PreviousState = Event->Header.SignalState;
83 
84  /* Check if we are non-signaled and we have stuff in the Wait Queue */
85  if (!PreviousState && !IsListEmpty(&Event->Header.WaitListHead))
86  {
87  /* Set the Event to Signaled */
88  Event->Header.SignalState = 1;
89 
90  /* Wake the Event */
91  KiWaitTest(&Event->Header, Increment);
92  }
93 
94  /* Unsignal it */
95  Event->Header.SignalState = 0;
96 
97  /* Check what wait state was requested */
98  if (Wait == FALSE)
99  {
100  /* Wait not requested, release Dispatcher Database and return */
102  }
103  else
104  {
105  /* Return Locked and with a Wait */
107  Thread->WaitNext = TRUE;
108  Thread->WaitIrql = OldIrql;
109  }
110 
111  /* Return the previous State */
112  return PreviousState;
113 }
#define ASSERT_IRQL_LESS_OR_EQUAL(x)
Definition: debug.h:251
#define TRUE
Definition: types.h:120
VOID FASTCALL KiWaitTest(PVOID Object, KPRIORITY Increment)
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
#define ASSERT_EVENT(Object)
UCHAR KIRQL
Definition: env_spec_w32.h:591
long LONG
Definition: pedump.c:60
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
_In_ PLARGE_INTEGER _In_opt_ PTIMER_APC_ROUTINE _In_opt_ PVOID _In_ BOOLEAN _In_opt_ LONG _Out_opt_ PBOOLEAN PreviousState
Definition: zwfuncs.h:428
FORCEINLINE VOID KiReleaseDispatcherLock(IN KIRQL OldIrql)
Definition: ke_x.h:152
FORCEINLINE KIRQL KiAcquireDispatcherLock(VOID)
Definition: ke_x.h:144
#define KeGetCurrentThread
Definition: hal.h:44
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG Increment
Definition: CrNtStubs.h:42
IN BOOLEAN Wait
Definition: fatprocs.h:1529

Referenced by EngMapEvent(), NtPulseEvent(), START_TEST(), and TestEventFunctional().

◆ KeReadStateEvent()

LONG NTAPI KeReadStateEvent ( IN PKEVENT  Event)

Definition at line 120 of file eventobj.c.

121 {
123 
124  /* Return the Signal State */
125  return Event->Header.SignalState;
126 }
#define ASSERT_EVENT(Object)

Referenced by EngReadStateEvent(), IopAbortInterruptedIrp(), lock_volume(), MiNotifyMemoryEvents(), NtQueryEvent(), QueueThread(), TdiCall(), TdiSendThread(), and TestCreateEvent().

◆ KeResetEvent()

LONG NTAPI KeResetEvent ( IN PKEVENT  Event)

Definition at line 133 of file eventobj.c.

134 {
135  KIRQL OldIrql;
139 
140  /* Lock the Dispatcher Database */
142 
143  /* Save the Previous State */
144  PreviousState = Event->Header.SignalState;
145 
146  /* Set it to zero */
147  Event->Header.SignalState = 0;
148 
149  /* Release Dispatcher Database and return previous state */
151  return PreviousState;
152 }
#define ASSERT_IRQL_LESS_OR_EQUAL(x)
Definition: debug.h:251
#define ASSERT_EVENT(Object)
UCHAR KIRQL
Definition: env_spec_w32.h:591
long LONG
Definition: pedump.c:60
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
_In_ PLARGE_INTEGER _In_opt_ PTIMER_APC_ROUTINE _In_opt_ PVOID _In_ BOOLEAN _In_opt_ LONG _Out_opt_ PBOOLEAN PreviousState
Definition: zwfuncs.h:428
FORCEINLINE VOID KiReleaseDispatcherLock(IN KIRQL OldIrql)
Definition: ke_x.h:152
FORCEINLINE KIRQL KiAcquireDispatcherLock(VOID)
Definition: ke_x.h:144

Referenced by NtResetEvent(), and TestEventFunctional().

◆ KeSetEvent()

LONG NTAPI KeSetEvent ( IN PKEVENT  Event,
IN KPRIORITY  Increment,
IN BOOLEAN  Wait 
)

Definition at line 159 of file eventobj.c.

162 {
163  KIRQL OldIrql;
168 
169  /*
170  * Check if this is an signaled notification event without an upcoming wait.
171  * In this case, we can immediately return TRUE, without locking.
172  */
173  if ((Event->Header.Type == EventNotificationObject) &&
174  (Event->Header.SignalState == 1) &&
175  !(Wait))
176  {
177  /* Return the signal state (TRUE/Signalled) */
178  return TRUE;
179  }
180 
181  /* Lock the Dispathcer Database */
183 
184  /* Save the Previous State */
185  PreviousState = Event->Header.SignalState;
186 
187  /* Set the Event to Signaled */
188  Event->Header.SignalState = 1;
189 
190  /* Check if the event just became signaled now, and it has waiters */
191  if (!(PreviousState) && !(IsListEmpty(&Event->Header.WaitListHead)))
192  {
193  /* Check the type of event */
194  if (Event->Header.Type == EventNotificationObject)
195  {
196  /* Unwait the thread */
197  KxUnwaitThread(&Event->Header, Increment);
198  }
199  else
200  {
201  /* Otherwise unwait the thread and unsignal the event */
203  }
204  }
205 
206  /* Check what wait state was requested */
207  if (!Wait)
208  {
209  /* Wait not requested, release Dispatcher Database and return */
211  }
212  else
213  {
214  /* Return Locked and with a Wait */
216  Thread->WaitNext = TRUE;
217  Thread->WaitIrql = OldIrql;
218  }
219 
220  /* Return the previous State */
221  return PreviousState;
222 }
#define ASSERT_IRQL_LESS_OR_EQUAL(x)
Definition: debug.h:251
#define TRUE
Definition: types.h:120
FORCEINLINE VOID KxUnwaitThreadForEvent(IN PKEVENT Event, IN KPRIORITY Increment)
Definition: ke_x.h:1295
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
#define ASSERT_EVENT(Object)
UCHAR KIRQL
Definition: env_spec_w32.h:591
long LONG
Definition: pedump.c:60
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
_In_ PLARGE_INTEGER _In_opt_ PTIMER_APC_ROUTINE _In_opt_ PVOID _In_ BOOLEAN _In_opt_ LONG _Out_opt_ PBOOLEAN PreviousState
Definition: zwfuncs.h:428
FORCEINLINE VOID KiReleaseDispatcherLock(IN KIRQL OldIrql)
Definition: ke_x.h:152
FORCEINLINE KIRQL KiAcquireDispatcherLock(VOID)
Definition: ke_x.h:144
FORCEINLINE VOID KxUnwaitThread(IN DISPATCHER_HEADER *Object, IN KPRIORITY Increment)
Definition: ke_x.h:1250
#define KeGetCurrentThread
Definition: hal.h:44
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG Increment
Definition: CrNtStubs.h:42
IN BOOLEAN Wait
Definition: fatprocs.h:1529

Referenced by __brelse(), _Dispatch_type_(), _Function_class_(), acpi_bus_generate_event_dpc(), AcpiOsSignalSemaphore(), AcpiOsWaitSemaphore(), AcquireMutexThread(), AcquireResourceThread(), add_calc_job(), AfdEventSelect(), BatteryClassStatusNotify(), Bus_CompletionRoutine(), CancelSelectSuspend(), CcPostDeferredWrites(), CcpUnpinData(), CcUninitializeCacheMap(), CcWorkerThread(), CdMultiSyncCompletionRoutine(), CdPnpCompletionRoutine(), CdRomClassIoctlCompletion(), CdRomMediaChangeCompletion(), CdRomUpdateMmcDriveCapabilitiesCompletion(), CdSingleSyncCompletionRoutine(), CdSyncCompletionRoutine(), ChewWorkItem(), chunk_unlock_range(), ClassCompletionRoutine(), ClassDeviceControl(), ClassDispatchPnp(), ClasspCleanupProtectedLocks(), ClasspEjectionControl(), ClasspSendSynchronousCompletion(), ClassReleaseChildLock(), ClassReleaseRemoveLock(), ClassSetFailurePredictionPoll(), ClassSignalCompletion(), close_file(), CmBattIoCompletion(), co_MsqDispatchOneSentMessage(), co_MsqSendMessage(), CompletionRoutine(), CountThread(), create_calc_threads(), CreateRemoteDatabaseWorker(), CTESignal(), DbgkpCloseObject(), DbgkpQueueMessage(), DbgkpSetProcessDebugObject(), DbgkpWakeTarget(), DesktopThreadMain(), DeviceStatusChangeThread(), DiskReleasePartitioningLock(), do_calc(), do_unlock_volume(), DpcForIsr(), DpcRoutine(), DriverIoControl(), EngSetEvent(), EventCallback(), ExfReleaseRundownProtection(), ExfReleaseRundownProtectionEx(), ExitThreadCallback(), ExNotifyCallback(), ExpSetSwappingKernelApc(), ExQueueWorkItem(), Ext2AllocateMcb(), Ext2bhReaperThread(), Ext2FcbReaperThread(), Ext2McbReaperThread(), Ext2MediaEjectControlCompletion(), Ext2QueryUnusedBH(), Ext2ReadWriteBlockSyncCompletionRoutine(), Ext2ReleaseFcb(), Ext2StopReaper(), FatCallSelfCompletionRoutine(), FatDeviceControlCompletionRoutine(), FatFspMarkVolumeDirtyWithRecover(), FatHijackCompletionRoutine(), FatMarkVolumeCompletionRoutine(), FatMultiAsyncCompletionRoutine(), FatMultiSyncCompletionRoutine(), FatOverflowPagingFileRead(), FatPagingFileCompletionRoutineCatch(), FatPnpCompletionRoutine(), FatSingleAsyncCompletionRoutine(), FatSingleSyncCompletionRoutine(), FatSpecialSyncCompletionRoutine(), FDO_QueryCapabilitiesCompletionRoutine(), FFSMediaEjectControlCompletion(), FFSReadWriteBlockSyncCompletionRoutine(), FinishThread(), FltpDisconnectPort(), ForwardIrpAndWaitCompletion(), ForwardIrpCompletion(), FreeBT_IoDecrement(), FreeDeviceData(), FsRecLoadFileSystem(), FsRtlCompletionRoutinePriv(), FsRtlStackOverflowRead(), HalGetAdapter(), HaliRegisterBusHandler(), HalpGrowMapBufferWorker(), HalPutDmaAdapter(), handle_upcall(), Hid_PnpCompletion(), HidClass_ReadCompleteIrp(), HidClassFDO_DispatchRequestSynchronousCompletion(), HidClassFDO_QueryCapabilitiesCompletionRoutine(), IdleNotificationRequestComplete(), IdlePing(), IdleRequestWorkerRoutine(), InitializeDeviceData(), IntMsqSetWakeMask(), IntVideoPortForwardIrpAndWaitCompletionRoutine(), IoAcquireRemoveLockEx(), IofCompleteRequest(), IopAcquireFileObjectLock(), IopCompleteRequest(), IopDeviceFsIoControl(), IopFreeReserveIrp(), IopLoadUnloadDriverWorker(), IopMountVolume(), IopQueueTargetDeviceEvent(), IopRemovePlugPlayEvent(), IopSetEvent(), IopSynchronousCompletion(), IopUnlockFileObject(), IoReleaseRemoveLockEx(), IoVerifyVolume(), IPSendComplete(), IrpCompletionRoutine(), KbdHid_CreateCompletion(), KbdHid_ReadCompletion(), KbdHid_StartDeviceCompletion(), KdpPrintToLogFile(), KdpTimeSlipWork(), KiQuantumEnd(), KmtFinishThread(), KmtUserModeCallback(), KsGenerateEvent(), KspForwardIrpSynchronousCompletion(), KspInstallBusEnumInterface(), KspRemoveBusInterface(), KspSetGetBusDataCompletion(), LibTCPBindCallback(), LibTCPCloseCallback(), LibTCPConnectCallback(), LibTCPListenCallback(), LibTCPSendCallback(), LibTCPShutdownCallback(), LibTCPSocketCallback(), lock_volume(), LpcRequestPort(), LpcRequestWaitReplyPort(), MapRegisterCallback(), MiDecrementAvailablePages(), MiDispatchFault(), MiIncrementAvailablePages(), MiInitializePoolEvents(), MiInsertPageInFreeList(), MiniRequestComplete(), MiNotifyMemoryEvents(), MiResolvePageFileFault(), MmRebalanceMemoryConsumers(), MmRosNotifyAvailablePage(), MotorStopDpcFunc(), MouHid_CreateCompletion(), MouHid_ReadCompletion(), MouHid_StartDeviceCompletion(), MsfsTimeout(), MsqCleanupThreadMsgs(), MsqRemoveWindowMessagesFromQueue(), MsqWakeQueue(), NdisBusMasterMapRegisterCallback(), NdisIForwardIrpAndWaitCompletionRoutine(), NdisSetEvent(), NdisSubordinateMapRegisterCallback(), NduCloseAdapterComplete(), NduOpenAdapterComplete(), NduReceive(), NduRequestComplete(), NduResetComplete(), NduSendComplete(), NduTransferDataComplete(), nfs41_downcall(), nfs41_FinalizeNetRoot(), nfs41_upcall(), nfs41_UpcallWaitForReply(), NpCommonRead(), NpCommonWrite(), NpSetClosingPipeState(), NpSetDisconnectedPipeState(), NpTransceive(), NtDebugContinue(), NtLockFile(), NtReadFile(), NtRequestPort(), NtRequestWaitReplyPort(), NtSecureConnectPort(), NtSetEvent(), NtSetHighEventPair(), NtSetHighWaitLowEventPair(), NtSetLowEventPair(), NtSetLowWaitHighEventPair(), NtSignalAndWaitForSingleObject(), NtWriteFile(), PciAssignSlotResources(), PciFindParentPciFdoExtension(), PciFindPdoByFunction(), PciFindPdoByLocation(), PciIdeXGenericCompletion(), PciInsertEntryAtHead(), PciInsertEntryAtTail(), PciScanBus(), PciSetEventCompletion(), PipeWorkerThread(), PoIrpCompletionFunc(), PollReeval(), PopFlushVolumeWorker(), PopProcessShutDownLists(), PpSetCustomTargetEvent(), ProtocolCloseAdapterComplete(), ProtocolOpenAdapterComplete(), ProtocolRequestComplete(), ProtocolResetComplete(), PspGetOrSetContextKernelRoutine(), PwrCompletionCallback(), RamdiskIoCompletionRoutine(), read_send_buffer(), ReadIrpCancel(), RemoveWorkItem(), RequestedPowerCompletion(), resume_balance(), resume_scrub(), RfsdMediaEjectControlCompletion(), RfsdReadWriteBlockSyncCompletionRoutine(), RxCommonWrite(), RxCreateNetRootCallBack(), RxCreateSrvCallCallBack(), RxDereferenceAndDeleteRxContext_Real(), RxLowIoWriteShellCompletion(), RxPurgeChangeBufferingStateRequestsForSrvOpen(), RxpWorkerThreadDispatcher(), RxScavengeFobxsForNetRoot(), RxScavengerTimerRoutine(), RxSpinUpRequestsDispatcher(), RxSpinUpWorkerThread(), ScsiClassInterpretSenseInfo(), SendOnlineNotificationWorker(), SerialReceiveByte(), SermouseInternalDeviceControl(), SoundProgramDMA(), START_TEST(), stop_balance(), stop_scrub(), StreamClassDeviceNotification(), SubmitIdleRequestIrp(), SyncForwardIrpCompletionRoutine(), sys_mbox_post(), sys_sem_signal(), sys_shutdown(), TCPWakeup(), TdiOpenThread(), TdiUnload(), TestEventFunctional(), TestEventScheduling(), TestOwnerRes(), TimerDpcRoutine(), TransferPktComplete(), TriggerWork(), UDFAsyncCompletionRoutine(), UDFEjectReqWaiter(), UDFMountVolume(), UDFPnpCompletionRoutine(), UDFStackOverflowRead(), UDFStopEjectWaiter(), UDFVWaitQueued(), UDFVWorkItem(), uninit(), Unload(), USBH_ChangeIndication(), USBH_ChangeIndicationAckChangeComplete(), USBH_ChangeIndicationProcessChange(), USBH_ChangeIndicationWorker(), USBH_CheckHubIdle(), USBH_CheckIdleAbort(), USBH_CompletePowerIrp(), USBH_FdoCleanup(), USBH_FdoIdleNotificationCallback(), USBH_FdoIdleNotificationRequestComplete(), USBH_FdoPoRequestD0Completion(), USBH_FdoQueryBusRelations(), USBH_FdoSubmitIdleRequestIrp(), USBH_FdoSubmitWaitWakeIrp(), USBH_FdoWWIrpIoCompletion(), USBH_FlushPortPwrList(), USBH_HubESDRecoverySetD3Completion(), USBH_HubPnPIrpComplete(), USBH_HubSetDWakeCompletion(), USBH_IrpCompletion(), USBH_PdoIoctlGetPortStatus(), USBH_PdoRemoveDevice(), USBH_ResetDevice(), USBH_ResetPortWorker(), USBH_SyncIrpComplete(), USBH_SyncResetPort(), USBH_UrbTimeoutDPC(), USBH_Worker(), USBHUB_RootHubCallBack(), USBPORT_CompleteTransfer(), USBPORT_FdoStartCompletion(), USBPORT_SignalWorkerThread(), USBSTOR_CompletionRoutine(), USBSTOR_QueueTerminateRequest(), USBSTOR_SyncCompletionRoutine(), USBSTOR_SyncForwardIrpCompletionRoutine(), VfatReadWritePartialCompletion(), VfatStackOverflowRead(), VfdCreateDevice(), VfdDeleteDevice(), VfdDeviceControl(), VfdReadWrite(), VideoPortSetEvent(), wait_for_flush(), WCacheCompleteAsync__(), WdmAudInitWorkerRoutine(), WorkerThread(), and WorkItemRoutine().

◆ KeSetEventBoostPriority()

VOID NTAPI KeSetEventBoostPriority ( IN PKEVENT  Event,
IN PKTHREAD *WaitingThread  OPTIONAL 
)

Definition at line 229 of file eventobj.c.

231 {
232  KIRQL OldIrql;
233  PKWAIT_BLOCK WaitBlock;
234  PKTHREAD Thread = KeGetCurrentThread(), WaitThread;
235  ASSERT(Event->Header.Type == EventSynchronizationObject);
237 
238  /* Acquire Dispatcher Database Lock */
240 
241  /* Check if the list is empty */
242  if (IsListEmpty(&Event->Header.WaitListHead))
243  {
244  /* Set the Event to Signaled */
245  Event->Header.SignalState = 1;
246 
247  /* Return */
249  return;
250  }
251 
252  /* Get the Wait Block */
253  WaitBlock = CONTAINING_RECORD(Event->Header.WaitListHead.Flink,
254  KWAIT_BLOCK,
255  WaitListEntry);
256 
257  /* Check if this is a WaitAll */
258  if (WaitBlock->WaitType == WaitAll)
259  {
260  /* Set the Event to Signaled */
261  Event->Header.SignalState = 1;
262 
263  /* Unwait the thread and unsignal the event */
265  }
266  else
267  {
268  /* Return waiting thread to caller */
269  WaitThread = WaitBlock->Thread;
270  if (WaitingThread) *WaitingThread = WaitThread;
271 
272  /* Calculate new priority */
273  Thread->Priority = KiComputeNewPriority(Thread, 0);
274 
275  /* Unlink the waiting thread */
276  KiUnlinkThread(WaitThread, STATUS_SUCCESS);
277 
278  /* Request priority boosting */
279  WaitThread->AdjustIncrement = Thread->Priority;
280  WaitThread->AdjustReason = AdjustBoost;
281 
282  /* Ready the thread */
283  KiReadyThread(WaitThread);
284  }
285 
286  /* Release the Dispatcher Database Lock */
288 }
#define ASSERT_IRQL_LESS_OR_EQUAL(x)
Definition: debug.h:251
FORCEINLINE VOID KxUnwaitThreadForEvent(IN PKEVENT Event, IN KPRIORITY Increment)
Definition: ke_x.h:1295
VOID FASTCALL KiUnlinkThread(IN PKTHREAD Thread, IN LONG_PTR WaitStatus)
Definition: wait.c:55
struct _KTHREAD * Thread
Definition: ketypes.h:453
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
FORCEINLINE SCHAR KiComputeNewPriority(IN PKTHREAD Thread, IN SCHAR Adjustment)
Definition: ke_x.h:1458
UCHAR KIRQL
Definition: env_spec_w32.h:591
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
VOID NTAPI KiReadyThread(IN PKTHREAD Thread)
Definition: thrdschd.c:429
UCHAR WaitType
Definition: ketypes.h:446
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define EVENT_INCREMENT
Definition: iotypes.h:565
FORCEINLINE VOID KiReleaseDispatcherLock(IN KIRQL OldIrql)
Definition: ke_x.h:152
FORCEINLINE KIRQL KiAcquireDispatcherLock(VOID)
Definition: ke_x.h:144
#define KeGetCurrentThread
Definition: hal.h:44
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by _ExReleaseFastMutex(), _ExReleaseFastMutexUnsafe(), ExfUnblockPushLock(), ExReleaseFastMutex(), ExReleaseResourceForThreadLite(), and NtSetEventBoostPriority().