I'm asking this out of curiosity.
Windows provides what they call a Fibers API, which is a API for lightweight user processes/threads.
I was interested in knowing if Mac OS provides such features as well. As far as I could find out, the closest Unix equivalent to that would be the setcontext
family of functions. However, trying to call such API on a Mac program produces warnings saying that the functions have been deprecated since OSX 10.6. Also, when I attempt to compile and run the example provided in the Wikipedia link above, I get a seg fault on my machine at the first swapcontext
.
So apparently the setcontext
API is a no go for Mac. Not any longer at least. Is there any other way to achieve lightweight user-side threads on Mac OS? Does the system provide such functionality?