Class ThreadUtil
Provides utility methods for managing threads and asynchronous tasks within the TriLib Exporter framework.
Inherited Members
Namespace: TriLibExporter
Assembly: Assembly-CSharp.dll
Syntax
public static class ThreadUtil
Methods
RequestNewThreadFor<T>(T, Action<T>, Action<T>, Action<IContextualizedError>, int, string, bool, Action<T>)
Runs the given action on a new thread if the IAssetWriterContext is asynchronous, otherwise executes it on the main thread.
Declaration
public static Task RequestNewThreadFor<T>(T context, Action<T> onStart, Action<T> onComplete = null, Action<IContextualizedError> onError = null, int timeout = 0, string name = null, bool startImmediately = true, Action<T> onCompleteSameThread = null) where T : class, IAssetWriterContext
Parameters
Type | Name | Description |
---|---|---|
T | context | The context to be passed to the action. |
Action<T> | onStart | The method to execute on the new thread. |
Action<T> | onComplete | The method to call on the main thread when the thread completes. |
Action<IContextualizedError> | onError | The method to call on the main thread when an error occurs. |
int | timeout | The thread timeout in seconds. |
string | name | The name of the created thread. |
bool | startImmediately | Indicates whether the task should start immediately. |
Action<T> | onCompleteSameThread | The method to call on the created thread after |
Returns
Type | Description |
---|---|
Task | The created task if asynchronous, otherwise |
Type Parameters
Name | Description |
---|---|
T | The type of the thread context. |