ReckfellThread
Worker startup, result and required joining.
ReckfellThread runs a Callable separately from the main thread. IsAlive reports callback execution, while IsStarted remains true until WaitToFinish, even after a result is returned. Retain the thread until joining; Dispose is not completion.
Shutdown flow: synchronize an exit request → wake a waiting worker → let it return → WaitToFinish() → release synchronization objects. Do not join while holding a mutex needed by the worker.
A thread makes neither the active Entity hierarchy nor shared Resources safe. Disabling checks does not fix access. Threading workflow. Windows headless lifecycle/synchronization were executed; priorities, stress, disabling checks and exception transport were not accepted.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
ReckfellThreadConstructor
public ReckfellThread();Creates an unstarted engine thread, not System.Threading.Thread or Task. Retain the object and Callable target through completion; after successful Start call WaitToFinish before disposal/restart. Destroying the wrapper is not cancellation.
Methods7
GetIdstring
public string GetId();Returns the engine-assigned ID string for this run. Before Start and after WaitToFinish it is "0". After callback completion but before joining it remains assigned. Not guaranteed to equal an OS thread ID or ManagedThreadId; not a persistent key across runs.
stringEngine ID string or "0" outside a started, unjoined lifecycle.
IsAlivebool
public bool IsAlive();Reports that the callback is still executing, including a wait on Semaphore/Mutex. False does not mean the thread has been joined: WaitToFinish is still required after execution. Not a result-success test or cancellation operation.
boolTrue while the callback is executing/waiting.
IsMainThreadbool
public static bool IsMainThread();Checks the calling thread rather than an instance state. True on the engine main thread and false in the tested worker. Does not automatically make access to every Resource/Entity safe.
boolTrue when this call originates on the main thread.
IsStartedbool
public bool IsStarted();True after successful Start until WaitToFinish, even if the callback already returned. Not synonymous with IsAlive. Start is rejected until joining; a completed but unjoined thread still needs cleanup.
boolTrue after Start until joining, including a completed callback.
SetThreadSafetyChecksEnabledvoid
public static void SetThreadSafetyChecksEnabled(bool enabled);Changes access checks for the current worker thread; calling from the main thread is forbidden. enabled=false adds no locking and makes neither the active tree nor resources thread-safe. Do not use to hide a race. QA called only true from a worker; disabling and invalid main-thread use were not executed.
| Name | Type | Default |
|---|---|---|
enabled | bool | — |
enabledTrue enables current-worker checks; false suppresses them without synchronizing access.
StartError
public Error Start(Callable callable, ReckfellThread.Priority priority = ReckfellThread.Priority.Normal);Starts a Callable without supplied arguments; retrieve its result through WaitToFinish. Error.Ok means startup was accepted, not that work completed successfully. Cannot restart before joining; invalid Callable/priority returns InvalidParameter. Keep the Callable target alive. Priority is a scheduler request rather than a timing guarantee. No Task-style exception/cancellation contract is provided; implement a synchronized stop flag and wake a waiting worker when needed.
| Name | Type | Default |
|---|---|---|
callable | Callable | — |
priority | ReckfellThread.Priority | ReckfellThread.Priority.Normal |
callableLive Callable requiring no supplied arguments; do not invoke the delegate in advance instead of passing it.
priorityLow, Normal or High; a scheduling request, not a speed/order guarantee.
ErrorStartup-acceptance Error; Ok does not mean a completed result.
WaitToFinishVariant
public Variant WaitToFinish();Blocks the caller until the callback completes, returns its Variant and joins the native thread. IsStarted then becomes false and another Start is allowed. Do not call from the worker itself, before Start, or while holding a mutex the worker needs: that causes an error/deadlock. First allow the worker to exit its wait. IsAlive=false does not remove the need to join. The callback may depend on the main thread; do not block it without considering that dependency.
VariantOwned Variant holding the callback result; Nil can be a valid result and can also occur for invalid use.
ReckfellThread.Priority
| Value | Description |
|---|---|
High = 2 | A thread running with higher priority than normally. |
Low = 0 | A thread running with lower priority than normally. |
Normal = 1 | A thread with a standard priority. |