Are fibers available in iOS (aka user mode threads, cooperative multitasking)?
I’m not too interested in a debate as to whether or not they’re a good idea (IMO user mode threads are often a good alternative to state machines, or nodejs-like callback models). I’m just trying to figure out if this is something I will have available in my toolbox.
See http://en.wikipedia.org/wiki/Fiber_%28computer_science%29
(Clarifying the question)
Yes. Both the
pthreadslibrary and Foundation’sNSThreadobject provide this functionality.(In general, the restrictions in iOS don’t affect POSIX-compliance – all functions in the POSIX C standard library are available, libpthreads is no exception.)
Edit: setcontext function family.