<Reference Include="System.Threading.Overlapped" />
<Reference Include="System.Threading.ThreadPool" />
</ItemGroup>
+ <ItemGroup Condition="'$(TargetsUnix)' == 'true'">
+ <Reference Include="System.Threading.Thread" />
+ </ItemGroup>
</Project>
throw new InternalException(err);
}
- //
- // Start the event loop on its own thread.
- //
bool suppressFlow = !ExecutionContext.IsFlowSuppressed();
try
{
if (suppressFlow) ExecutionContext.SuppressFlow();
- Task.Factory.StartNew(
- s => ((SocketAsyncEngine)s!).EventLoop(),
- this,
- CancellationToken.None,
- TaskCreationOptions.LongRunning,
- TaskScheduler.Default);
+
+ Thread thread = new Thread(s => ((SocketAsyncEngine)s!).EventLoop());
+ thread.IsBackground = true;
+ thread.Name = ".NET Sockets";
+ thread.Start(this);
}
finally
{