Alvaro Lopez Ortega    
Archives
« November 2009
MonTueWedThuFriSatSun
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
      
Today
XML
Search

Links
 

Today's Page Hits: 437

« Priceless, indeed | Main | New Valgrind for... »
20071227 Thursday December 27, 2007
Howto: Coroutines in C

Coroutines in C: "So each time the decompressor emits another character, it saves its program counter and jumps to the last known location within the parser - and each time the parser needs another character, it saves its own program counter and jumps to the location saved by the decompressor. Control shuttles back and forth between the two routines exactly as often as necessary."

I would describe this interesting (and dirty) programming trick as "How to implement yield in plain C. Worth a read.


Dec 27 2007, 10:12:53 AM GMT+00:00 Permalink

Comments:

Post a Comment:

Comments are closed for this entry.