예제 #1
0
        /// <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 CfrWaitableEvent Create(int automaticReset, int initiallySignaled)
        {
            var call = new CfxWaitableEventCreateRemoteCall();

            call.automaticReset    = automaticReset;
            call.initiallySignaled = initiallySignaled;
            call.RequestExecution();
            return(CfrWaitableEvent.Wrap(new RemotePtr(call.__retval)));
        }
예제 #2
0
        /// <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 CfrWaitableEvent Create(bool automaticReset, bool initiallySignaled)
        {
            var connection = CfxRemoteCallContext.CurrentContext.connection;
            var call       = new CfxWaitableEventCreateRemoteCall();

            call.automaticReset    = automaticReset;
            call.initiallySignaled = initiallySignaled;
            call.RequestExecution(connection);
            return(CfrWaitableEvent.Wrap(new RemotePtr(connection, call.__retval)));
        }
예제 #3
0
        internal static CfrWaitableEvent Wrap(RemotePtr remotePtr)
        {
            if (remotePtr == RemotePtr.Zero)
            {
                return(null);
            }
            var weakCache = CfxRemoteCallContext.CurrentContext.connection.weakCache;

            lock (weakCache) {
                var cfrObj = (CfrWaitableEvent)weakCache.Get(remotePtr.ptr);
                if (cfrObj == null)
                {
                    cfrObj = new CfrWaitableEvent(remotePtr);
                    weakCache.Add(remotePtr.ptr, cfrObj);
                }
                return(cfrObj);
            }
        }