public class Thread extends Object implements Runnable:
Logical thread abstraction.
This implementation keeps thread lifecycle semantics in Klyn while delegating blocking primitives (sleep and yield) to the runtime.
| Modifier and Type | Member | Description |
|---|---|---|
| public static readonly property | activeCountactiveCount as UInt: |
Returns the number of logically active threads. |
| public static readonly property | currentThreadcurrentThread as Thread: |
Returns the current logical thread. |
| public readonly property | idid as ULong: |
Unique thread id. |
| public readonly property | isAliveisAlive as Boolean: |
Returns true while this thread is not terminated. |
| public readonly property | isInterruptedisInterrupted as Boolean: |
Returns true when interruption was requested. |
| public property | namename as String: |
Thread name. |
| public property | prioritypriority as String: |
Logical thread priority. |
| public readonly property | statestate as String: |
Current lifecycle state. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | ThreadThread(): |
Creates a thread with an auto-generated name derived from its unique id. |
| public | Thread | No summary. |
| Modifier and Type | Member | Description |
|---|---|---|
| public static | currentcurrent() as Thread: |
Alias for `currentThread`. |
| public | interruptinterrupt() as Void: |
Marks the thread as interrupted. |
| public | joinjoin() as Void: |
Waits for completion. |
| public | joinjoin(timeoutMillis as Int) as Void: |
Waits up to a timeout in milliseconds. |
| public | resumeresume() as Void: |
Resumes execution logically. |
| public override | runrun() as Void: |
Runnable entrypoint. |
| public static | sleepsleep(millis as Int) as Void: |
Puts the current thread to sleep. |
| public | startstart() as Void: |
Starts the thread execution. |
| public | stopstop() as Void: |
Stops the thread logically. |
| public | suspendsuspend() as Void: |
Suspends execution logically. |
| public override | toStringtoString() as String: |
Returns a readable thread representation. |
| public static | withTarget | Creates a thread and binds a runnable target. |
| public static | yieldyield() as Void: |
Provides a scheduler hint to yield execution. |