
I know it's wayyy too late in the game for any top-level requirements. But I would recommend inserting a potentially user-customizable functional element between the context-save and the context-restore.
Maybe you already have it and I'm a dummy who can't see it.
Do you know why I suggest this?
Because we could specialize the functional element to implement a simple (nearly portable) time-slicing cooperative multitasking scheduler simply using a container filled with (coroutine + timer) objects. You already have a yield() function. And I do see some evidence of events and waiting. With a scheduling element and a potential sleep_for() function we could essentially get a robust cooperative multitasking scheduler *right off the rack* from boost.
I'm currently working on a library for cooperative multitasking (containing a scheduler etc.) - boost.stratified. It provides some kind of user-land threads together with mutexs, condition- and event variables ... Maybe we can talk about it in a private conversation. regards, Oliver