Provides helper methods for launching Threads.
More...
|
static Thread | StartAsync (ThreadStart execute, [Localizable(false)] string? name=null) |
| Starts executing a delegate in a new thread suitable for WinForms. More...
|
|
static Thread | StartBackground (ThreadStart execute, [Localizable(false)] string? name=null) |
| Starts executing a delegate in a new background thread (automatically terminated when application exits). More...
|
|
static void | RunSta (Action execute) |
| Executes a delegate in a new ApartmentState.STA thread. Blocks the caller until the execution completes. More...
|
|
static T | RunSta< T > (Func< T > execute) |
| Executes a delegate in a new ApartmentState.STA thread. Blocks the caller until the execution completes. More...
|
|
Provides helper methods for launching Threads.
◆ RunSta()
static void NanoByte.Common.ThreadUtils.RunSta |
( |
Action |
execute | ) |
|
|
inlinestatic |
Executes a delegate in a new ApartmentState.STA thread. Blocks the caller until the execution completes.
- Parameters
-
execute | The delegate to execute. |
This is useful for code that needs to be executed in a Single-Threaded Apartment (e.g. WinForms code) when the calling thread is not set up to handle COM.
◆ RunSta< T >()
Executes a delegate in a new ApartmentState.STA thread. Blocks the caller until the execution completes.
- Template Parameters
-
T | The type of the return value of execute . |
- Parameters
-
execute | The delegate to execute. |
- Returns
- The return value of execute
This is useful for code that needs to be executed in a Single-Threaded Apartment (e.g. WinForms code) when the calling thread is not set up to handle COM.
◆ StartAsync()
static Thread NanoByte.Common.ThreadUtils.StartAsync |
( |
ThreadStart |
execute, |
|
|
[Localizable(false)] string? |
name = null |
|
) |
| |
|
inlinestatic |
Starts executing a delegate in a new thread suitable for WinForms.
- Parameters
-
execute | The delegate to execute. |
name | A short name for the new thread; can be null . |
- Returns
- The newly launched thread.
◆ StartBackground()
static Thread NanoByte.Common.ThreadUtils.StartBackground |
( |
ThreadStart |
execute, |
|
|
[Localizable(false)] string? |
name = null |
|
) |
| |
|
inlinestatic |
Starts executing a delegate in a new background thread (automatically terminated when application exits).
- Parameters
-
execute | The delegate to execute. |
name | A short name for the new thread; can be null . |
- Returns
- The newly launched thread.
The documentation for this class was generated from the following file: