public void Release <TResult>(RequestKey key, TResult result) { lock (this) { var waitHandle = (RequestWaitHandle <TResult>)_waitHandles[key]; _waitHandles.Remove(key); waitHandle.Release(result); } }
public void ReleaseWithException <TResult>(RequestKey key, Exception thrownException) { lock (this) { var waitHandle = (RequestWaitHandle <TResult>)_waitHandles[key]; _waitHandles.Remove(key); waitHandle.ReleaseWithException(thrownException); } }
public bool ShouldWaitForHandle <TResult>(RequestKey key, out RequestWaitHandle <TResult> waitHandle) { lock (this) { object waitHandleObject; if (_waitHandles.TryGetValue(key, out waitHandleObject)) { waitHandle = (RequestWaitHandle <TResult>)waitHandleObject; return(true); } waitHandle = new RequestWaitHandle <TResult>(); _waitHandles[key] = waitHandle; return(false); } }