Hi Min,

Basically, there is only one thread. Function inlining is independent of threads. Even without function inlining, when one function calls another function it is still the same thread. Interrupt handlers on the other hand get called asynchronously (as the result of an external event, for instace) and they execute in a somewhat special environment. As the name implys, they interrupt the execution of the main thread. For this reason, if an interrupt handler accesses a shared variable, access to that variable should be protected (with atomic statemens).

Cheers,
Urs


Min Guo schrieb:
Does TinyOS use multipule threads or not? I see the following sentences in
the programming manuel:

 [..]

Does that mean there is only one thread in every application? When a
function A calles function B, will A
just inline the codes of B at the calling point? However, if so why do we
need to consider about the preemptive
things - since there is only one thread, where do the interupts come from?


Kind regards,
Min
_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to