Instructions

356Libraries
© 2013 Conrad Electronic
tions Thread_Wait and Thread_Signal.
A thread bound to wait will execute instruction Thread_Wait with a signal number. The condition of
the thread is set on waiting. This means that the thread may be ignored at a possible thread change.
If the other thread has completed its critical work it will send the command Thread_Signal with the
same signal number the first thread had used for its Thread_Wait. The thread condition of the waiting
thread will change from waiting to inactive and will then be considered again at a possible thread
change.
Deadlocks
When all active threads set out for a waiting condition with Thread_Wait then there will be no more
threads which can release the other threads from their waiting conditon. Therefore these constella-
tions should be avoided when programming.
Table Thread Conditions
Condition
Meaning
active
The thread is presently executed
inactive
Can be activated again after a thread change
sleeping
Will after a number of ticks be set to "inactive"
again
waiting
The thread awaits a signal
5.25.1 Thread_Cycles
Thread Functions
Syntax
void Thread_Cycles(byte thread, word cycles);
Sub Thread_Cycles(thread As Byte, cycles As Word)
Description
Sets the number of executed bytecode instructions before thread change to the parameter cycles.
If a thread is freshly started, it will get the cycle count that was defined in the project options. It only
makes sense to call Thread_Cylces() after a thread has been started.
Parameter
thread (0-13) number of the thread
cycles cycle count until thread change