←back to thread

142 points jmillikin | 4 comments | | HN request time: 0.998s | source
1. Nursie ◴[] No.44547796[source]
Cooperative multithreading via setjmp and longjmp has been around in C since the 80s at least.

I’m not sure this is so much hacking as an accepted technique from the old-old days which has somewhat fallen out of favour, especially as C is falling a little outside of the mainstream these days.

Perhaps it’s almost becoming lost knowledge :)

replies(1): >>44548029 #
2. ajb ◴[] No.44548029[source]
This isn't using setjmp/longjmp

It's using Simon Tatham's method based on Duff's device (https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html)

replies(1): >>44548333 #
3. Nursie ◴[] No.44548333[source]
Sure, I guess I just wanted to point out that regardless of method, people have been building these sorts of facilities in C for a very long time.

It doesn’t lessen the achievement of course, but it amuses me an in “everything old is new again” kinda way.

replies(1): >>44549248 #
4. johnisgood ◴[] No.44549248{3}[source]
"everything old is new again" is so true. I see it across IT all the time, heh.