Re:Async.h – asynchronous, stackless subroutines in C
by naasking on Saturday September 21, 2019 @10:34AM
(#21035607)
My intent was to play around with different approaches for Arduino programming. I saw a bunch of blocking functions, like delay(), and thought that seemed silly and made me wish for async/await. I realised at that point that I could do it via macros with the same approach used by protothreads.
[ Parent
| on HN ]
Re:Async.h – asynchronous, stackless subroutines in C
by bxparks on Saturday September 21, 2019 @11:58AM
(#21036076)
I found that computed-goto (https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html) is cleaner than Duff's Device for this sort of thing. (It works for clang compiler too.) Take a look at https://github.com/bxparks/AceRoutine for an Arduino library that uses computed-goto.