ICLRSyncManager::CreateRWLockOwnerIterator Method


Requests that the common language runtime (CLR) create an iterator for the host to use to determine the set of tasks waiting on a reader-writer lock.

HRESULT CreateRWLockOwnerIterator (  
    [in]  SIZE_T    cookie,  
    [out] SIZE_T   *pIterator  


[in] The cookie associated with the desired reader-writer lock.

[out] A pointer to an iterator that can be passed to the GetRWLockOwnerNext and DeleteRWLockOwnerIterator methods.

S_OKCreateRWLockOwnerIterator returned successfully.
HOST_E_CLRNOTAVAILABLEThe CLR has not been loaded into a process, or the CLR is in a state in which it cannot run managed code or process the call successfully.
HOST_E_TIMEOUTThe call timed out.
HOST_E_NOT_OWNERThe caller does not own the lock.
HOST_E_ABANDONEDAn event was canceled while a blocked thread or fiber was waiting on it.
E_FAILAn unknown catastrophic failure occurred. When a method returns E_FAIL, the CLR is no longer usable within the process. Subsequent calls to hosting methods return HOST_E_CLRNOTAVAILABLE.
HOST_E_INVALIDOPERATIONCreateRWLockOwnerIterator was called on a thread that is currently running managed code.

Hosts typically call the CreateRWLockOwnerIterator, DeleteRWLockOwnerIterator, and GetRWLockOwnerNext methods during deadlock detection. The host is responsible for ensuring that the reader-writer lock is still valid, because the CLR makes no attempt to keep the reader-writer lock alive. Several strategies are available for the host to ensure the validity of the lock:

  • The host can block release calls on the reader-writer lock (for example, IHostSemaphore::ReleaseSemaphore) while ensuring that this block does not cause deadlock.

  • The host can block the exit from waiting on the event object associated with the reader-writer lock, again ensuring that this block does not cause deadlock.

System_CAPS_ICON_note.jpg Note

CreateRWLockOwnerIterator must be called only on threads that are currently executing unmanaged code.

Platforms: See System Requirements.

Header: MSCorEE.h

Library: Included as a resource in MSCorEE.dll

.NET Framework Versions: Available since 2.0

ICLRSyncManager Interface
IHostSyncManager Interface