Always create TaskCompletionSource<T> with TaskCreationOptions.RunContinuationsAsynchronously
This commit is contained in:
parent
cd675475bc
commit
832da133d8
|
@ -29,7 +29,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IMediaEncoder _mediaEncoder;
|
private readonly IMediaEncoder _mediaEncoder;
|
||||||
private readonly IServerApplicationPaths _appPaths;
|
private readonly IServerApplicationPaths _appPaths;
|
||||||
private readonly TaskCompletionSource<bool> _taskCompletionSource = new TaskCompletionSource<bool>();
|
private readonly TaskCompletionSource<bool> _taskCompletionSource = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||||
private readonly IServerConfigurationManager _serverConfigurationManager;
|
private readonly IServerConfigurationManager _serverConfigurationManager;
|
||||||
private readonly JsonSerializerOptions _jsonOptions = JsonDefaults.Options;
|
private readonly JsonSerializerOptions _jsonOptions = JsonDefaults.Options;
|
||||||
private bool _hasExited;
|
private bool _hasExited;
|
||||||
|
|
|
@ -133,7 +133,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
var taskCompletionSource = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||||
|
|
||||||
_ = StartStreaming(
|
_ = StartStreaming(
|
||||||
udpClient,
|
udpClient,
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||||
|
|
||||||
SetTempFilePath("ts");
|
SetTempFilePath("ts");
|
||||||
|
|
||||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
var taskCompletionSource = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||||
|
|
||||||
_ = StartStreaming(response, taskCompletionSource, LiveStreamCancellationTokenSource.Token);
|
_ = StartStreaming(response, taskCompletionSource, LiveStreamCancellationTokenSource.Token);
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ namespace Emby.Server.Implementations.Net
|
||||||
{
|
{
|
||||||
ThrowIfDisposed();
|
ThrowIfDisposed();
|
||||||
|
|
||||||
var taskCompletion = new TaskCompletionSource<SocketReceiveResult>();
|
var taskCompletion = new TaskCompletionSource<SocketReceiveResult>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||||
bool isResultSet = false;
|
bool isResultSet = false;
|
||||||
|
|
||||||
Action<IAsyncResult> callback = callbackResult =>
|
Action<IAsyncResult> callback = callbackResult =>
|
||||||
|
@ -195,7 +195,7 @@ namespace Emby.Server.Implementations.Net
|
||||||
{
|
{
|
||||||
ThrowIfDisposed();
|
ThrowIfDisposed();
|
||||||
|
|
||||||
var taskCompletion = new TaskCompletionSource<int>();
|
var taskCompletion = new TaskCompletionSource<int>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||||
bool isResultSet = false;
|
bool isResultSet = false;
|
||||||
|
|
||||||
Action<IAsyncResult> callback = callbackResult =>
|
Action<IAsyncResult> callback = callbackResult =>
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace MediaBrowser.Common.Extensions
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add an event handler for the process exit event
|
// Add an event handler for the process exit event
|
||||||
var tcs = new TaskCompletionSource<bool>();
|
var tcs = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||||
process.Exited += (_, _) => tcs.TrySetResult(true);
|
process.Exited += (_, _) => tcs.TrySetResult(true);
|
||||||
|
|
||||||
// Return immediately if the process has already exited
|
// Return immediately if the process has already exited
|
||||||
|
|
Loading…
Reference in New Issue
Block a user