TriLib Exporter
Search Results for

    Show / Hide Table of Contents

    Class ThreadUtil

    Provides utility methods for managing threads and asynchronous tasks within the TriLib Exporter framework.

    Inheritance
    object
    ThreadUtil
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    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 onStart completes.

    Returns
    Type Description
    Task

    The created task if asynchronous, otherwise null.

    Type Parameters
    Name Description
    T

    The type of the thread context.

    In this article
    Back to top Generated by DocFX