I'm trying to find a lightweight cooperative threading solution to try implementing an actor model. As far as I know, the only solution is setcontext/getcontext, but the functionality is deprecated(?) by Apple. I'm confused by why they did this; however, I'm finding replacement for this.
- Pthreads are not an option because I need cooperative model instead of preemptive model to control context switching timing precisely/manually without expensive locking.
-- edit --
Reason of avoiding pthreads: Because pthreads are not cooperative/deterministic and too expensive. I need actor model for game logic code, so thousand of execution context are required at minimal. Hardware threading requires MB of memory and expense to create/destruct. And parallelism is not important. In fact, I just need concurrent execution of many functions. This can be implemented with many divided functions and some kind of object model, but my goal is reducing those overheads.
If I know something wrong, please correct me. It'll be very appreciated.