# Sandbox.ThreadSafe

Provides utilities for working with threads, particularly for identifying
and asserting code is running on the main thread.

- Kind: class
- Namespace: `Sandbox`
- Assembly: `Sandbox.System`
- Modifiers: static, abstract, sealed

## Properties

- [`CurrentThreadId`](/api/Sandbox.ThreadSafe/CurrentThreadId): Gets the current thread's managed thread ID.
- [`CurrentThreadName`](/api/Sandbox.ThreadSafe/CurrentThreadName): Gets the current thread's name, or null if unnamed.
- [`IsMainThread`](/api/Sandbox.ThreadSafe/IsMainThread): Returns true if currently executing on the main thread.

## Methods

- [`AssertIsMainThread`](/api/Sandbox.ThreadSafe/AssertIsMainThread): Throws an exception if not called from the main thread. Useful for enforcing thread safety on main-thread-only APIs.
- [`AssertIsNotMainThread`](/api/Sandbox.ThreadSafe/AssertIsNotMainThread): Throws an exception if called from the main thread. Useful for enforcing that blocking operations don't run on the main thread.
