File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
src/Renci.SshNet/Abstractions Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -19,15 +19,23 @@ public static void Sleep(int millisecondsTimeout)
1919#endif
2020 }
2121
22+ public static void ExecuteThreadLongRunning ( Action action )
23+ {
24+ #if FEATURE_THREAD_TAP
25+ var taskCreationOptions = System . Threading . Tasks . TaskCreationOptions . LongRunning ;
26+ System . Threading . Tasks . Task . Factory . StartNew ( action , taskCreationOptions ) ;
27+ #else
28+ var thread = new System . Threading . Thread ( ( ) => action ( ) ) ;
29+ thread . Start ( ) ;
30+ #endif
31+ }
32+
2233 /// <summary>
2334 /// Executes the specified action in a separate thread.
2435 /// </summary>
2536 /// <param name="action">The action to execute.</param>
2637 public static void ExecuteThread ( Action action )
2738 {
28- if ( action == null )
29- throw new ArgumentNullException ( "action" ) ;
30-
3139#if FEATURE_THREAD_THREADPOOL
3240 System . Threading . ThreadPool . QueueUserWorkItem ( o => action ( ) ) ;
3341#elif FEATURE_THREAD_TAP
You can’t perform that action at this time.
0 commit comments