@@ -5,22 +5,30 @@ namespace Platform.Threading
55{
66 public static class ThreadHelpers
77 {
8- public const int DefaultMaxStackSize = 0 ;
9- public const int DefaultSleepTimeout = 1 ;
10- public const int ExtendedMaxStackSize = 200 * 1024 * 1024 ;
8+ public static readonly int DefaultMaxStackSize = 0 ;
9+ public static readonly int ExtendedMaxStackSize = 200 * 1024 * 1024 ;
10+ public static readonly int DefaultSleepTimeout = 1 ;
1111
12- public static void SyncInvokeWithExtendedStack < T > ( T param , Action < object > action , int maxStackSize = ExtendedMaxStackSize ) => StartNew ( param , action , maxStackSize ) . Join ( ) ;
12+ public static void SyncInvokeWithExtendedStack < T > ( T param , Action < object > action ) => SyncInvokeWithExtendedStack ( param , action , ExtendedMaxStackSize ) ;
1313
14- public static void SyncInvokeWithExtendedStack ( Action action , int maxStackSize = ExtendedMaxStackSize ) => StartNew ( action , maxStackSize ) . Join ( ) ;
14+ public static void SyncInvokeWithExtendedStack < T > ( T param , Action < object > action , int maxStackSize ) => StartNew ( param , action , maxStackSize ) . Join ( ) ;
1515
16- public static Thread StartNew < T > ( T param , Action < object > action , int maxStackSize = DefaultMaxStackSize )
16+ public static void SyncInvokeWithExtendedStack ( Action action ) => SyncInvokeWithExtendedStack ( action , ExtendedMaxStackSize ) ;
17+
18+ public static void SyncInvokeWithExtendedStack ( Action action , int maxStackSize ) => StartNew ( action , maxStackSize ) . Join ( ) ;
19+
20+ public static Thread StartNew < T > ( T param , Action < object > action ) => StartNew ( param , action , DefaultMaxStackSize ) ;
21+
22+ public static Thread StartNew < T > ( T param , Action < object > action , int maxStackSize )
1723 {
1824 var thread = new Thread ( new ParameterizedThreadStart ( action ) , maxStackSize ) ;
1925 thread . Start ( param ) ;
2026 return thread ;
2127 }
2228
23- public static Thread StartNew ( Action action , int maxStackSize = DefaultMaxStackSize )
29+ public static Thread StartNew ( Action action ) => StartNew ( action , DefaultMaxStackSize ) ;
30+
31+ public static Thread StartNew ( Action action , int maxStackSize )
2432 {
2533 var thread = new Thread ( new ThreadStart ( action ) , maxStackSize ) ;
2634 thread . Start ( ) ;
0 commit comments