|
|
|
@ -1,5 +1,4 @@ |
|
|
|
using System; |
|
|
|
using System.ComponentModel; |
|
|
|
using System.Diagnostics; |
|
|
|
using System.Threading; |
|
|
|
using System.Threading.Tasks; |
|
|
|
@ -118,11 +117,11 @@ public partial class Dispatcher |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Executes the specified Func<TResult> synchronously on the
|
|
|
|
/// Executes the specified Func<TResult> synchronously on the
|
|
|
|
/// thread that the Dispatcher was created on.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="callback">
|
|
|
|
/// A Func<TResult> delegate to invoke through the dispatcher.
|
|
|
|
/// A Func<TResult> delegate to invoke through the dispatcher.
|
|
|
|
/// </param>
|
|
|
|
/// <returns>
|
|
|
|
/// The return value from the delegate being invoked.
|
|
|
|
@ -136,11 +135,11 @@ public partial class Dispatcher |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Executes the specified Func<TResult> synchronously on the
|
|
|
|
/// Executes the specified Func<TResult> synchronously on the
|
|
|
|
/// thread that the Dispatcher was created on.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="callback">
|
|
|
|
/// A Func<TResult> delegate to invoke through the dispatcher.
|
|
|
|
/// A Func<TResult> delegate to invoke through the dispatcher.
|
|
|
|
/// </param>
|
|
|
|
/// <param name="priority">
|
|
|
|
/// The priority that determines in what order the specified
|
|
|
|
@ -156,11 +155,11 @@ public partial class Dispatcher |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Executes the specified Func<TResult> synchronously on the
|
|
|
|
/// Executes the specified Func<TResult> synchronously on the
|
|
|
|
/// thread that the Dispatcher was created on.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="callback">
|
|
|
|
/// A Func<TResult> delegate to invoke through the dispatcher.
|
|
|
|
/// A Func<TResult> delegate to invoke through the dispatcher.
|
|
|
|
/// </param>
|
|
|
|
/// <param name="priority">
|
|
|
|
/// The priority that determines in what order the specified
|
|
|
|
@ -183,11 +182,11 @@ public partial class Dispatcher |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Executes the specified Func<TResult> synchronously on the
|
|
|
|
/// Executes the specified Func<TResult> synchronously on the
|
|
|
|
/// thread that the Dispatcher was created on.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="callback">
|
|
|
|
/// A Func<TResult> delegate to invoke through the dispatcher.
|
|
|
|
/// A Func<TResult> delegate to invoke through the dispatcher.
|
|
|
|
/// </param>
|
|
|
|
/// <param name="priority">
|
|
|
|
/// The priority that determines in what order the specified
|
|
|
|
@ -317,11 +316,11 @@ public partial class Dispatcher |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Executes the specified Func<TResult> asynchronously on the
|
|
|
|
/// Executes the specified Func<TResult> asynchronously on the
|
|
|
|
/// thread that the Dispatcher was created on.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="callback">
|
|
|
|
/// A Func<TResult> delegate to invoke through the dispatcher.
|
|
|
|
/// A Func<TResult> delegate to invoke through the dispatcher.
|
|
|
|
/// </param>
|
|
|
|
/// <returns>
|
|
|
|
/// An operation representing the queued delegate to be invoked.
|
|
|
|
@ -335,11 +334,11 @@ public partial class Dispatcher |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Executes the specified Func<TResult> asynchronously on the
|
|
|
|
/// Executes the specified Func<TResult> asynchronously on the
|
|
|
|
/// thread that the Dispatcher was created on.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="callback">
|
|
|
|
/// A Func<TResult> delegate to invoke through the dispatcher.
|
|
|
|
/// A Func<TResult> delegate to invoke through the dispatcher.
|
|
|
|
/// </param>
|
|
|
|
/// <param name="priority">
|
|
|
|
/// The priority that determines in what order the specified
|
|
|
|
@ -355,11 +354,11 @@ public partial class Dispatcher |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Executes the specified Func<TResult> asynchronously on the
|
|
|
|
/// Executes the specified Func<TResult> asynchronously on the
|
|
|
|
/// thread that the Dispatcher was created on.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="callback">
|
|
|
|
/// A Func<TResult> delegate to invoke through the dispatcher.
|
|
|
|
/// A Func<TResult> delegate to invoke through the dispatcher.
|
|
|
|
/// </param>
|
|
|
|
/// <param name="priority">
|
|
|
|
/// The priority that determines in what order the specified
|
|
|
|
@ -479,7 +478,7 @@ public partial class Dispatcher |
|
|
|
// operation has already started when the timeout expires,
|
|
|
|
// we still wait for it to complete. This is different
|
|
|
|
// than simply waiting on the operation with a timeout
|
|
|
|
// because we are the ones queueing the dispatcher
|
|
|
|
// because we are the ones queuing the dispatcher
|
|
|
|
// operation, not the caller. We can't leave the operation
|
|
|
|
// in a state that it might execute if we return that it did not
|
|
|
|
// invoke.
|
|
|
|
@ -492,12 +491,12 @@ public partial class Dispatcher |
|
|
|
|
|
|
|
// Old async semantics return from Wait without
|
|
|
|
// throwing an exception if the operation was aborted.
|
|
|
|
// There is no need to test the timout condition, since
|
|
|
|
// There is no need to test the timeout condition, since
|
|
|
|
// the old async semantics would just return the result,
|
|
|
|
// which would be null.
|
|
|
|
|
|
|
|
// This should not block because either the operation
|
|
|
|
// is using the old async sematics, or the operation
|
|
|
|
// is using the old async semantics, or the operation
|
|
|
|
// completed successfully.
|
|
|
|
result = operation.GetResult(); |
|
|
|
} |
|
|
|
@ -543,11 +542,11 @@ public partial class Dispatcher |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Executes the specified Func<Task> asynchronously on the
|
|
|
|
/// Executes the specified Func<Task> asynchronously on the
|
|
|
|
/// thread that the Dispatcher was created on
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="callback">
|
|
|
|
/// A Func<Task> delegate to invoke through the dispatcher.
|
|
|
|
/// A Func<Task> delegate to invoke through the dispatcher.
|
|
|
|
/// </param>
|
|
|
|
/// <param name="priority">
|
|
|
|
/// The priority that determines in what order the specified
|
|
|
|
@ -564,11 +563,11 @@ public partial class Dispatcher |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Executes the specified Func<Task<TResult>> asynchronously on the
|
|
|
|
/// Executes the specified Func<Task<TResult>> asynchronously on the
|
|
|
|
/// thread that the Dispatcher was created on
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="callback">
|
|
|
|
/// A Func<Task<TResult>> delegate to invoke through the dispatcher.
|
|
|
|
/// <param name="action">
|
|
|
|
/// A Func<Task<TResult>> delegate to invoke through the dispatcher.
|
|
|
|
/// </param>
|
|
|
|
/// <param name="priority">
|
|
|
|
/// The priority that determines in what order the specified
|
|
|
|
@ -595,4 +594,4 @@ public partial class Dispatcher |
|
|
|
_ = action ?? throw new ArgumentNullException(nameof(action)); |
|
|
|
InvokeAsyncImpl(new SendOrPostCallbackDispatcherOperation(this, priority, action, arg, true), CancellationToken.None); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|