File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -21,12 +21,17 @@ public static void Sleep(int millisecondsTimeout)
21
21
22
22
public static void ExecuteThreadLongRunning ( Action action )
23
23
{
24
+ if ( action == null )
25
+ throw new ArgumentNullException ( "action" ) ;
26
+
24
27
#if FEATURE_THREAD_TAP
25
28
var taskCreationOptions = System . Threading . Tasks . TaskCreationOptions . LongRunning ;
26
29
System . Threading . Tasks . Task . Factory . StartNew ( action , taskCreationOptions ) ;
27
30
#else
28
- var thread = new System . Threading . Thread ( ( ) => action ( ) ) ;
29
- thread . Start ( ) ;
31
+ new System . Threading . Thread ( ( ) => action ( ) )
32
+ {
33
+ IsBackground = true
34
+ } . Start ( ) ;
30
35
#endif
31
36
}
32
37
Original file line number Diff line number Diff line change @@ -618,7 +618,8 @@ public void Connect()
618
618
_messageListenerCompleted . Reset ( ) ;
619
619
620
620
// Start incoming request listener
621
- ThreadAbstraction . ExecuteThread ( ( ) => MessageListener ( ) ) ;
621
+ // ToDo: Make message pump async, to not consume a thread for every session
622
+ ThreadAbstraction . ExecuteThreadLongRunning ( ( ) => MessageListener ( ) ) ;
622
623
623
624
// Wait for key exchange to be completed
624
625
WaitOnHandle ( _keyExchangeCompletedWaitHandle ) ;
You can’t perform that action at this time.
0 commit comments