s&box docs

public static abstract sealed class Sandbox.ThreadSafe

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

Methods

Showing 2 methods

public 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.

Parameters

  • memberName: Automatically filled with the calling method name

Exceptions

ExceptionCondition
ExceptionThrown if not on the main thread

public 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.

Exceptions

ExceptionCondition
ExceptionThrown if on the main thread

Properties

Showing 3 properties

public static int Sandbox.ThreadSafe.CurrentThreadId { get; set; }

Gets the current thread's managed thread ID.

public static string Sandbox.ThreadSafe.CurrentThreadName { get; set; }

Gets the current thread's name, or null if unnamed.

public static bool Sandbox.ThreadSafe.IsMainThread { get; set; }

Returns true if currently executing on the main thread.

Metadata

FieldValue
NamespaceSandbox
Typeclass
AssemblySandbox.System
Doc IDT:Sandbox.ThreadSafe

On this page