ICLRSyncManager::GetMonitorOwner Method

Gets the IHostTask instance that owns the monitor identified by the specified cookie.

HRESULT GetMonitorOwner (
    [in]  SIZE_T     cookie,
    [out] IHostTask *ppOwnerHostTask
);

cookie

[in] The cookie associated with the monitor.

ppOwnerHostTask

[out] A pointer to the IHostTask that currently owns the monitor, or null if no task has ownership.

HRESULT

Description

S_OK

GetMonitorOwner returned successfully.

HOST_E_CLRNOTAVAILABLE

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.

HOST_E_TIMEOUT

The call timed out.

HOST_E_NOT_OWNER

The caller does not own the lock.

HOST_E_ABANDONED

An event was canceled while a blocked thread or fiber was waiting on it.

E_FAIL

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.

NoteNote

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.

Header: MSCorEE.h

Library: Included as a resource in MSCorEE.dll

.NET Framework Versions: 4, 3.5 SP1, 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft