diff -uNr pt-1.2.1-orig/lc-switch.h pt-1.2.1-rsk/lc-switch.h --- pt-1.2.1-orig/lc-switch.h 2005-04-01 03:08:25.000000000 -0600 +++ pt-1.2.1-rsk/lc-switch.h 2006-01-23 13:29:42.000000000 -0600 @@ -63,9 +63,13 @@ /** \hideinitializer */ typedef unsigned short lc_t; +#define LC_TERM_MARKER 0xffff + +#define LC_TERM(s) s = LC_TERM_MARKER; + #define LC_INIT(s) s = 0; -#define LC_RESUME(s) switch(s) { case 0: +#define LC_RESUME(s) switch(s) { case LC_TERM_MARKER: break; case 0: #define LC_SET(s) s = __LINE__; case __LINE__: diff -uNr pt-1.2.1-orig/pt.h pt-1.2.1-rsk/pt.h --- pt-1.2.1-orig/pt.h 2005-10-06 02:56:35.000000000 -0500 +++ pt-1.2.1-rsk/pt.h 2006-01-23 13:32:15.000000000 -0600 @@ -113,6 +113,11 @@ */ #define PT_INIT(pt) LC_INIT((pt)->lc) +/* + * XXX: Document -- rsk + */ +#define PT_TERM(pt) LC_TERM((pt)->lc) + /** * Declare the start of a protothread inside the C function * implementing the protothread. @@ -303,6 +308,7 @@ #define PT_EXIT(pt) \ do { \ PT_INIT(pt); \ + PT_TERM(pt); \ return PT_THREAD_EXITED; \ } while(0)