Process Hacker
sync.c File Reference
#include <phbase.h>

Go to the source code of this file.

Functions

VOID FASTCALL PhfInitializeEvent (_Out_ PPH_EVENT Event)
 Initializes an event object.
 
FORCEINLINE VOID PhpDereferenceEvent (_Inout_ PPH_EVENT Event, _In_opt_ HANDLE EventHandle)
 Dereferences the event object used by an event.
 
FORCEINLINE VOID PhpReferenceEvent (_Inout_ PPH_EVENT Event)
 References the event object used by an event.
 
VOID FASTCALL PhfSetEvent (_Inout_ PPH_EVENT Event)
 Sets an event object.
 
BOOLEAN FASTCALL PhfWaitForEvent (_Inout_ PPH_EVENT Event, _In_opt_ PLARGE_INTEGER Timeout)
 Waits for an event object to be set.
 
VOID FASTCALL PhfResetEvent (_Inout_ PPH_EVENT Event)
 Resets an event's state.
 
VOID FASTCALL PhfInitializeBarrier (_Out_ PPH_BARRIER Barrier, _In_ ULONG_PTR Target)
 
FORCEINLINE VOID PhpBlockOnBarrier (_Inout_ PPH_BARRIER Barrier, _In_ ULONG Role, _In_ BOOLEAN Spin)
 
BOOLEAN FASTCALL PhfWaitForBarrier (_Inout_ PPH_BARRIER Barrier, _In_ BOOLEAN Spin)
 Waits until all threads are blocking on the barrier, and resets the state of the barrier.
 
VOID FASTCALL PhfInitializeRundownProtection (_Out_ PPH_RUNDOWN_PROTECT Protection)
 
BOOLEAN FASTCALL PhfAcquireRundownProtection (_Inout_ PPH_RUNDOWN_PROTECT Protection)
 
VOID FASTCALL PhfReleaseRundownProtection (_Inout_ PPH_RUNDOWN_PROTECT Protection)
 
VOID FASTCALL PhfWaitForRundownProtection (_Inout_ PPH_RUNDOWN_PROTECT Protection)
 
VOID FASTCALL PhfInitializeInitOnce (_Out_ PPH_INITONCE InitOnce)
 
BOOLEAN FASTCALL PhfBeginInitOnce (_Inout_ PPH_INITONCE InitOnce)
 
VOID FASTCALL PhfEndInitOnce (_Inout_ PPH_INITONCE InitOnce)
 

Function Documentation

BOOLEAN FASTCALL PhfAcquireRundownProtection ( _Inout_ PPH_RUNDOWN_PROTECT  Protection)

Definition at line 373 of file sync.c.

BOOLEAN FASTCALL PhfBeginInitOnce ( _Inout_ PPH_INITONCE  InitOnce)

Definition at line 497 of file sync.c.

VOID FASTCALL PhfEndInitOnce ( _Inout_ PPH_INITONCE  InitOnce)

Definition at line 509 of file sync.c.

VOID FASTCALL PhfInitializeBarrier ( _Out_ PPH_BARRIER  Barrier,
_In_ ULONG_PTR  Target 
)

Definition at line 220 of file sync.c.

VOID FASTCALL PhfInitializeEvent ( _Out_ PPH_EVENT  Event)

Initializes an event object.

Parameters
EventA pointer to an event object.

Definition at line 58 of file sync.c.

VOID FASTCALL PhfInitializeInitOnce ( _Out_ PPH_INITONCE  InitOnce)

Definition at line 490 of file sync.c.

VOID FASTCALL PhfInitializeRundownProtection ( _Out_ PPH_RUNDOWN_PROTECT  Protection)

Definition at line 366 of file sync.c.

VOID FASTCALL PhfReleaseRundownProtection ( _Inout_ PPH_RUNDOWN_PROTECT  Protection)

Definition at line 398 of file sync.c.

VOID FASTCALL PhfResetEvent ( _Inout_ PPH_EVENT  Event)

Resets an event's state.

Parameters
EventA pointer to an event object.
Remarks
This function is not thread-safe. Make sure no other threads are using the event when you call this function.

Definition at line 210 of file sync.c.

VOID FASTCALL PhfSetEvent ( _Inout_ PPH_EVENT  Event)

Sets an event object.

Any threads waiting on the event will be released.

Parameters
EventA pointer to an event object.

Definition at line 110 of file sync.c.

BOOLEAN FASTCALL PhfWaitForBarrier ( _Inout_ PPH_BARRIER  Barrier,
_In_ BOOLEAN  Spin 
)

Waits until all threads are blocking on the barrier, and resets the state of the barrier.

Parameters
BarrierA barrier.
SpinTRUE to spin on the barrier before blocking, FALSE to block immediately.
Returns
TRUE for an unspecified thread after each phase, and FALSE for all other threads.
Remarks
By checking the return value of the function, in each phase an action can be performed exactly once. This could, for example, involve merging the results of calculations.

Definition at line 281 of file sync.c.

BOOLEAN FASTCALL PhfWaitForEvent ( _Inout_ PPH_EVENT  Event,
_In_opt_ PLARGE_INTEGER  Timeout 
)

Waits for an event object to be set.

Parameters
EventA pointer to an event object.
TimeoutThe timeout value.
Returns
TRUE if the event object was set before the timeout period expired, otherwise FALSE.
Remarks
To test the event, use PhTestEvent() instead of using a timeout of zero.

Definition at line 142 of file sync.c.

VOID FASTCALL PhfWaitForRundownProtection ( _Inout_ PPH_RUNDOWN_PROTECT  Protection)

Definition at line 439 of file sync.c.

FORCEINLINE VOID PhpBlockOnBarrier ( _Inout_ PPH_BARRIER  Barrier,
_In_ ULONG  Role,
_In_ BOOLEAN  Spin 
)

Definition at line 229 of file sync.c.

FORCEINLINE VOID PhpDereferenceEvent ( _Inout_ PPH_EVENT  Event,
_In_opt_ HANDLE  EventHandle 
)

Dereferences the event object used by an event.

Parameters
EventA pointer to an event object.
EventHandleThe current value of the event object.

Definition at line 72 of file sync.c.

FORCEINLINE VOID PhpReferenceEvent ( _Inout_ PPH_EVENT  Event)

References the event object used by an event.

Parameters
EventA pointer to an event object.

Definition at line 97 of file sync.c.