Api Sandbox ThreadSafe
class

ThreadSafe

public static abstract sealed class ThreadSafe

Provides utilities for working with threads, particularly for identifying and asserting code is running on the main thread.

Properties

Name Type Description
CurrentThreadId static Int32 Gets the current thread's managed thread ID.
CurrentThreadName static String Gets the current thread's name, or null if unnamed.
IsMainThread static Boolean Returns true if currently executing on the main thread.

Methods

static Void AssertIsMainThread(String memberName = )

Throws an exception if not called from the main thread. Useful for enforcing thread safety on main-thread-only APIs.

memberName — Automatically filled with the calling method name
Exception — Thrown if not on the main thread
static Void AssertIsNotMainThread()

Throws an exception if called from the main thread. Useful for enforcing that blocking operations don't run on the main thread.

Exception — Thrown if on the main thread
Assembly: Sandbox.System Namespace: Sandbox Full Name: Sandbox.ThreadSafe