module Godot::ThreadSafety

Defined in:

libgodot/thread_safety.cr

Class Method Summary

Class Method Detail

def self.assert_main_thread!(operation : String, target_class : String, node : Godot::Node | Nil = nil, child : Godot::Node | Nil = nil) : Void #

Master assertion called before thread-sensitive operations


def self.context_description : String #

Detailed human-readable description of current thread & execution context


def self.current_thread_id : UInt64 #

Fast query for native OS thread ID (~1ns, TLS segment register read)


def self.flush_main_thread_queue! : Void #

Flushes and executes all enqueued main thread actions. Called by the main loop during frame updates.


def self.main_thread? : Bool #

Returns true if current execution is on Godot's Main Thread


def self.main_thread_id : UInt64 #

def self.main_thread_id=(id : UInt64) #

Explicitly overrides the main thread ID (for test fixtures).


def self.policy : Policy #

def self.policy=(policy : Policy) #

def self.record_main_thread! : UInt64 #

Records the current thread as Godot's Main Thread.


def self.reset! : Void #

Resets main thread tracking (primarily for isolated test fixtures).


def self.run_on_main_thread(&block : -> Void) : Void #

Schedules a block to execute on the Main Thread. If already on the Main Thread, executes immediately. If on a background thread, enqueues to the thread-safe dispatch queue.


def self.scope : Scope #

def self.scope=(scope : Scope) #