Skip to content

Commit f04fff9

Browse files
Use TaskFactory in receive loop
1 parent ceb52e0 commit f04fff9

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

lib/ShortDev.Microsoft.ConnectedDevices/CdpSession.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Microsoft.Extensions.Logging;
2-
using ShortDev.IO.ValueStream;
32
using ShortDev.Microsoft.ConnectedDevices.Encryption;
43
using ShortDev.Microsoft.ConnectedDevices.Exceptions;
54
using ShortDev.Microsoft.ConnectedDevices.Internal;

lib/ShortDev.Microsoft.ConnectedDevices/ConnectedDevicesPlatform.MessageLoop.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ partial class ConnectedDevicesPlatform
1010
private void ReceiveLoop(CdpSocket socket)
1111
{
1212
RegisterKnownSocket(socket);
13-
Task.Run(() =>
13+
Task.Factory.StartNew(() =>
1414
{
1515
var streamReader = EndianReader.FromStream(Endianness.BigEndian, socket.InputStream);
1616
using (socket)
1717
{
1818
ReceiveLoop(socket, ref streamReader);
1919
}
20-
});
20+
}, TaskCreationOptions.LongRunning);
2121
}
2222

2323
void ReceiveLoop(CdpSocket socket, ref EndianReader<StreamWrapperStream> streamReader)

0 commit comments

Comments
 (0)