API ReferenceSandbox
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
| Exception | Condition |
|---|---|
Exception | Thrown 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
| Exception | Condition |
|---|---|
Exception | Thrown if on the main thread |
No results match this filter.
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.
No results match this filter.
Metadata
| Field | Value |
|---|---|
| Namespace | Sandbox |
| Type | class |
| Assembly | Sandbox.System |
| Doc ID | T:Sandbox.ThreadSafe |