HOME       UP       PREV       NEXT (Example using an SC_THREAD)  

Threads and Methods

The user code in an SC_MODULE is run either as an SC_THREAD or an SC_METHOD.

An SC_THREAD has a stack and is allowed to block.

An SC_METHOD is just an upcall from the event kernel and must not block.

Use SC_METHOD wherever possible, for efficiency.

Use SC_THREAD where important state must be retained in the program counter from one activation to the next or when asynchronous active behaviour is needed.

22: (C) 2008-11, DJ Greaves, University of Cambridge, Computer Laboratory.