Partager via


KeTryToAcquireGuardedMutex routine

The KeTryToAcquireGuardedMutex routine acquires a guarded mutex, if available.

Syntax

BOOLEAN KeTryToAcquireGuardedMutex(
  _Inout_ PKGUARDED_MUTEX Mutex
);

Parameters

  • Mutex [in, out]
    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

Target platform

Universal

Version

Available in Windows Server 2003 and later versions of Windows.

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

Library

NtosKrnl.lib

DLL

NtosKrnl.exe

IRQL

<= APC_LEVEL

DDI compliance rules

IrqlKeApcLte1, HwStorPortProhibitedDDIs

See also

KeReleaseGuardedMutex

 

 

Send comments about this topic to Microsoft