4576596 [rkeene@sledge /home/rkeene/devel/old]$ cat -n pt-1.2.1-yieldterm-2.diff
 1 diff -uNr pt-1.2.1-orig/lc-switch.h pt-1.2.1-rsk/lc-switch.h
 2 --- pt-1.2.1-orig/lc-switch.h   2005-04-01 03:08:25.000000000 -0600
 3 +++ pt-1.2.1-rsk/lc-switch.h    2006-01-23 13:29:42.000000000 -0600
 4 @@ -63,9 +63,13 @@
 5  /** \hideinitializer */
 6  typedef unsigned short lc_t;
 7  
 8 +#define LC_TERM_MARKER 0xffff
 9 +
10 +#define LC_TERM(s) s = LC_TERM_MARKER;
11 +
12  #define LC_INIT(s) s = 0;
13  
14 -#define LC_RESUME(s) switch(s) { case 0:
15 +#define LC_RESUME(s) switch(s) { case LC_TERM_MARKER: break; case 0:
16  
17  #define LC_SET(s) s = __LINE__; case __LINE__: 
18  
19 diff -uNr pt-1.2.1-orig/pt.h pt-1.2.1-rsk/pt.h
20 --- pt-1.2.1-orig/pt.h  2005-10-06 02:56:35.000000000 -0500
21 +++ pt-1.2.1-rsk/pt.h   2006-01-23 13:32:15.000000000 -0600
22 @@ -113,6 +113,11 @@
23   */
24  #define PT_INIT(pt)   LC_INIT((pt)->lc)
25  
26 +/*
27 + * XXX: Document -- rsk
28 + */
29 +#define PT_TERM(pt)   LC_TERM((pt)->lc)
30 +
31  /**
32   * Declare the start of a protothread inside the C function
33   * implementing the protothread.
34 @@ -303,6 +308,7 @@
35  #define PT_EXIT(pt)                \
36    do {                     \
37      PT_INIT(pt);               \
38 +    PT_TERM(pt);               \
39      return PT_THREAD_EXITED;           \
40    } while(0)
41  

pt-1.2.1-yieldterm-2.diff is a patch against Protothreads 1.2.1 that changes the way "PT_EXIT" ("PT_RETURN") works. It forces you to re-initialize the thread if you want to run it after termination.
4576597 [rkeene@sledge /home/rkeene/devel/old]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 2006-01-26 15:46:13