다음을 통해 공유


ExAcquireResourceSharedLite routine

The ExAcquireResourceSharedLite routine acquires the given resource for shared access by the calling thread.

Syntax

BOOLEAN ExAcquireResourceSharedLite(
  _Inout_ PERESOURCE Resource,
  _In_    BOOLEAN    Wait
);

Parameters

  • Resource [in, out]
    A pointer to the resource to acquire.

  • Wait [in]
    Specifies the routine's behavior whenever the resource cannot be acquired immediately. If TRUE, the caller is put into a wait state until the resource can be acquired. If FALSE, the routine immediately returns, regardless of whether the resource can be acquired.

Return value

The caller can release the resource by calling either ExReleaseResourceLite or ExReleaseResourceForThreadLite.

ExAcquireResourceSharedLite returns TRUE if (or when) the resource is acquired. This routine returns FALSE if the input Wait is FALSE and shared access cannot be granted immediately.

Remarks

Whether or when the caller is given shared access to the given resource depends on the following:

  • If the resource is currently unowned, shared access is granted immediately to the current thread.

  • If the caller already has acquired the resource (for shared or exclusive access), the current thread is granted the same type of access recursively. Note that making this call does not convert a caller's exclusive access of a given resource to shared access.

  • If the resource is currently owned as shared by another thread and no thread is waiting for exclusive access to the resource, shared access is granted to the caller immediately. The caller is put into a wait state if there is an exclusive waiter.

  • If the resource is currently owned as exclusive by another thread or if there is another thread waiting for exclusive access and the caller does not already have shared access to the resource, the current thread either is put into a wait state (Wait set to TRUE) or ExAcquireResourceSharedLite returns FALSE.

Normal kernel APC delivery must be disabled before calling this routine. Disable normal kernel APC delivery by calling KeEnterCriticalRegion. Delivery must remain disabled until the resource is released, at which point it can be reenabled by calling KeLeaveCriticalRegion. For more information, see Disabling APCs.

Requirements

Target platform

Universal

Version

Available starting with Windows 2000.

Header

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

Library

NtosKrnl.lib

DLL

NtosKrnl.exe

IRQL

<= APC_LEVEL

DDI compliance rules

IrqlExApcLte3, WithinCriticalRegion, HwStorPortProhibitedDDIs, WithinCriticalRegion(storport)

See also

ExAcquireResourceExclusiveLite

ExAcquireSharedStarveExclusive

ExAcquireSharedWaitForExclusive

ExConvertExclusiveToSharedLite

ExGetExclusiveWaiterCount

ExGetSharedWaiterCount

ExInitializeResourceLite

ExReinitializeResourceLite

ExIsResourceAcquiredSharedLite

ExReleaseResourceForThreadLite

 

 

Send comments about this topic to Microsoft