2.5.25. Thread

TODO.

2.5.25.1. Instructions

thread.get_context target [thread::GetContext]
Target:ref<context { } >

Returns the thread context of the currently executing virtual thread. The type of the result operand must opf type context, which is implicitly defined as current function’s thread context type. The instruction cannot be used if no such has been defined.

thread.id target [thread::ThreadID]
Target:int<64>

Returns the ID of the current virtual thread. Returns -1 if executed in the primary thread.

thread.schedule op1 op2 op3 [thread::Schedule]
Operator 1:function() -> void
Operator 2:tuple<*>
Operator 3:[ int<64> ]

Schedules a function call onto a virtual thread. If op3 is not given, the current thread context determines the target thread, according to HILTI context-based scheduling. If op3 is given, it gives the target thread ID directly; in this case the functions thread context will be cleared when running.

thread.set_context op1 [thread::SetContext]
Operator 1:any

Sets the thread context of the currently executing virtual thread to op1. The type of op1 must match the current module’s context definition.