ExAcquireResourceSharedLite

BOOLEAN
ExAcquireResourceSharedLite(

IN PERESOURCE Resource,
IN BOOLEAN Wait
);

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

Parameters

Resource

Points to the resource to acquire.

Wait

Is set to TRUE if the caller should be put into a wait state until the resource can be acquired if it cannot be acquired immediately.

Return Value

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.

Comments

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, the current thread is granted the same type of access recursively. Note that making this call does not convert a caller's exclusive ownership of a given resource to shared.

·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.

Callers of ExAcquireResourceSharedLite must be running at IRQL < DISPATCH_LEVEL.

See Also

ExAcquireResourceExclusiveLite, ExAcquireSharedStarveExclusive, ExAcquireSharedWaitForExclusive, ExConvertExclusiveToSharedLite, ExGetExclusiveWaiterCount, ExGetSharedWaiterCount, ExInitializeResourceLite, ExReinitializeResourceLite, ExIsResourceAcquiredSharedLite, ExReleaseResourceForThreadLite