Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make spaghetti stack with C?

I'm trying to make coroutine and continuation with C. I realized I need some kind of spaghetti stack. Is it possible to execute a function within a new call-stack? Of course within single thread. How can I make a new, separated call-stack, and execute some code on it?

like image 693
eonil Avatar asked May 02 '26 14:05

eonil


1 Answers

check out makecontext/swapcontext.

If those aren't available, then you could use setjmp/longjmp, but those are a little more complex.

like image 166
evil otto Avatar answered May 05 '26 03:05

evil otto