Threads in C



Threads in C require the following:

  • A thread declaration, with a dispatch expression.
  • A thread function (either a macro, function, or other code).

Thread Declarations

Thread declarations are in the form:

#pragma thread invocation INTERRUPT (expression);

Expressions are arbitrary, and may include macros or function calls.

Thread invocations are function or macro invocations, or alternatively short pieces of code.

When the program invokes the compiler-generated __DISPATCH() function, each of the declared thread expressions is evaluated in turn. When an expression evaluates to true, its associated thread code is run.


Thread PowerPoint with notes

Download a PowerPoint presentation on threads.