Gets the IHostTask instance that owns the monitor identified by the specified cookie.
[in] The cookie associated with the monitor.
[out] A pointer to the IHostTask that currently owns the monitor, or null if no task has ownership.
GetMonitorOwner returned successfully.
The 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.
The call timed out.
The caller does not own the lock.
An event was canceled while a blocked thread or fiber was waiting on it.
An 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.
The host typically calls GetMonitorOwner as part of a deadlock-detection mechanism. The cookie is associated with a monitor when it is created by using a call to IHostSyncManager::CreateMonitorEvent.
A call to release the event underlying the monitor might block—but will not deadlock—if a call to this method is currently in effect on the cookie associated with that monitor. Other tasks might also block if they attempt to acquire this monitor.
GetMonitorOwner always returns immediately and can be called any time after a call to CreateMonitorEvent. The host does not need to wait until a task is waiting on the event.
Platforms: See .NET Framework System Requirements.
Library: Included as a resource in MSCorEE.dll
.NET Framework Versions: Available since 2.0