Bewerken

Delen via


KeTryToAcquireGuardedMutex function (wdm.h)

The KeTryToAcquireGuardedMutex routine acquires a guarded mutex, if available.

Syntax

BOOLEAN KeTryToAcquireGuardedMutex(
  [in, out] PKGUARDED_MUTEX Mutex
);

Parameters

[in, out] Mutex

Pointer to the KGUARDED_MUTEX structure for the guarded mutex.

Return value

KeTryToAcquireGuardedMutex returns TRUE if the mutex is acquired, and FALSE otherwise.

Remarks

Use KeReleaseGuardedMutex to release the mutex.

KeTryToAcquireGuardedMutex returns immediately, regardless of whether it can acquire the mutex. Use KeAcquireGuardedMutex to put the calling thread into a wait state until mutex becomes available.

A thread that calls KeTryToAcquireGuardedMutex implicitly enters a guarded region, where all APCs are disabled. They remain disabled until the thread releases the mutex with KeReleaseGuardedMutex.

For more information about guarded mutexes, see Fast Mutexes and Guarded Mutexes.

Requirements

Requirement Value
Minimum supported client Available in Windows Server 2003 and later versions of Windows.
Target Platform Universal
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL <= APC_LEVEL
DDI compliance rules HwStorPortProhibitedDDIs(storport), IrqlKeApcLte1(wdm)

See also

KeReleaseGuardedMutex