Threads
[Virtual Machine]


Detailed Description

Implements an execution context for programs to execute. There is no real API for accessing and modifying a given thread, since all standard interaction is done in the current thread At opcode level.

Thread state transitions
thread_states.png


Modules

 Thread
 API to handle thread objects.
 Mutex
 API to handle mutual exclusion devices.
 Blocker
 API to handle blocking calls in VM instructions. A thread can be suspended synchronously and resumed asynchronously.

Functions

vm_t vm_run_program_fg (vm_t, program_t, word_t ip, word_t prio)
 run the given program with priority level prio and starting at offset ip, and join the thread.
vm_t vm_run_program_bg (vm_t, program_t, word_t ip, word_t prio)
 run the given program with priority level prio and starting at offset ip, and return immediately.
thread_t vm_add_thread (vm_t, program_t, word_t ip, word_t prio, int fg)
 start a new thread. Start a new thread with priority level prio and starting at offset ip in program. The VM engine is signaled the start and death of the thread if fg is non-zero.
thread_t vm_get_current_thread (vm_t)
 get current thread.
vm_t vm_kill_thread (vm_t, thread_t)
 kill a thread (thread resources won't be freed while it's referenced).


Function Documentation

vm_t vm_run_program_fg ( vm_t  ,
program_t  ,
word_t  ip,
word_t  prio 
)

run the given program with priority level prio and starting at offset ip, and join the thread.

vm_t vm_run_program_bg ( vm_t  ,
program_t  ,
word_t  ip,
word_t  prio 
)

run the given program with priority level prio and starting at offset ip, and return immediately.

thread_t vm_add_thread ( vm_t  ,
program_t  ,
word_t  ip,
word_t  prio,
int  fg 
)

start a new thread. Start a new thread with priority level prio and starting at offset ip in program. The VM engine is signaled the start and death of the thread if fg is non-zero.

thread_t vm_get_current_thread ( vm_t   ) 

get current thread.

vm_t vm_kill_thread ( vm_t  ,
thread_t   
)

kill a thread (thread resources won't be freed while it's referenced).


Generated on Wed Feb 6 14:46:05 2008 for TinyaML by  doxygen 1.5.3