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)
2121
2222 public static void ExecuteThreadLongRunning ( Action action )
2323 {
24+ if ( action == null )
25+ throw new ArgumentNullException ( "action" ) ;
26+
2427#if FEATURE_THREAD_TAP
2528 var taskCreationOptions = System . Threading . Tasks . TaskCreationOptions . LongRunning ;
2629 System . Threading . Tasks . Task . Factory . StartNew ( action , taskCreationOptions ) ;
2730#else
28- var thread = new System . Threading . Thread ( ( ) => action ( ) ) ;
29- thread . Start ( ) ;
31+ new System . Threading . Thread ( ( ) => action ( ) )
32+ {
33+ IsBackground = true
34+ } . Start ( ) ;
3035#endif
3136 }
3237
Original file line number Diff line number Diff line change @@ -618,7 +618,8 @@ public void Connect()
618618 _messageListenerCompleted . Reset ( ) ;
619619
620620 // 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 ( ) ) ;
622623
623624 // Wait for key exchange to be completed
624625 WaitOnHandle ( _keyExchangeCompletedWaitHandle ) ;
You can’t perform that action at this time.
0 commit comments