Marshals a single call from one thread to another.
Beispiel #1
0
        /// <summary>
        /// Sends an action to run when <see cref="PollingSynchronizationContext.CheckEvents"/> is called.
        /// This will block until then. This will lock up if you call it from the same thread you use for
        /// checking events.
        /// </summary>
        /// <param name="d">The callback.</param>
        /// <param name="state">State to pass to the callback.</param>
        public override void Send(SendOrPostCallback d, object state)
        {
            var call = new SynchronizedCall(d, state);

            this.Post(call_ => ((SynchronizedCall)call_).Run(), call);

            call.Wait();
        }
        /// <summary>
        /// Sends an action to run when <see cref="PollingSynchronizationContext.CheckEvents"/> is called.
        /// This will block until then. This will lock up if you call it from the same thread you use for
        /// checking events.
        /// </summary>
        /// <param name="d">The callback.</param>
        /// <param name="state">State to pass to the callback.</param>
        public override void Send(SendOrPostCallback d, object state)
        {
            var call = new SynchronizedCall(d, state);

            this.Post(call_ => ((SynchronizedCall)call_).Run(), call);

            call.Wait();
        }