reckfellENGINE

ReckfellThread

Worker startup, result and required joining.

On this page
class ReckfellThreadReckfellSharpInherits RefCounted

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
# ReckfellThread
C#
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
# GetId
C#
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.

Returns string

Engine ID string or "0" outside a started, unjoined lifecycle.

IsAlivebool
# IsAlive
C#
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.

Returns bool

True while the callback is executing/waiting.

IsMainThreadbool
# IsMainThread
C#
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.

Returns bool

True when this call originates on the main thread.

IsStartedbool
# IsStarted
C#
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.

Returns bool

True after Start until joining, including a completed callback.

SetThreadSafetyChecksEnabledvoid
# SetThreadSafetyChecksEnabled
C#
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.

Parameters
NameTypeDefault
enabledbool—
enabled

True enables current-worker checks; false suppresses them without synchronizing access.

StartError
# Start
C#
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.

Parameters
NameTypeDefault
callableCallable—
priorityReckfellThread.PriorityReckfellThread.Priority.Normal
callable

Live Callable requiring no supplied arguments; do not invoke the delegate in advance instead of passing it.

priority

Low, Normal or High; a scheduling request, not a speed/order guarantee.

Returns Error

Startup-acceptance Error; Ok does not mean a completed result.

WaitToFinishVariant
# WaitToFinish
C#
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.

Returns Variant

Owned Variant holding the callback result; Nil can be a valid result and can also occur for invalid use.

ReckfellThread.Priority

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

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.