internal static CfxWaitableEvent Wrap(IntPtr nativePtr) { if (nativePtr == IntPtr.Zero) { return(null); } lock (weakCache) { var wrapper = (CfxWaitableEvent)weakCache.Get(nativePtr); if (wrapper == null) { wrapper = new CfxWaitableEvent(nativePtr); weakCache.Add(wrapper); } else { CfxApi.cfx_release(nativePtr); } return(wrapper); } }
/// <summary> /// Create a new waitable event. If |automaticReset| is true (1) then the event /// state is automatically reset to un-signaled after a single waiting thread has /// been released; otherwise, the state remains signaled until reset() is called /// manually. If |initiallySignaled| is true (1) then the event will start in /// the signaled state. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_waitable_event_capi.h">cef/include/capi/cef_waitable_event_capi.h</see>. /// </remarks> public static CfxWaitableEvent Create(int automaticReset, int initiallySignaled) { return(CfxWaitableEvent.Wrap(CfxApi.WaitableEvent.cfx_waitable_event_create(automaticReset, initiallySignaled))); }
/// <summary> /// Create a new waitable event. If |automaticReset| is true (1) then the event /// state is automatically reset to un-signaled after a single waiting thread has /// been released; otherwise, the state remains signaled until reset() is called /// manually. If |initiallySignaled| is true (1) then the event will start in /// the signaled state. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_waitable_event_capi.h">cef/include/capi/cef_waitable_event_capi.h</see>. /// </remarks> public static CfxWaitableEvent Create(bool automaticReset, bool initiallySignaled) { return(CfxWaitableEvent.Wrap(CfxApi.WaitableEvent.cfx_waitable_event_create(automaticReset ? 1 : 0, initiallySignaled ? 1 : 0))); }