BuckeyeSoftware / rex

rex engine and game
MIT License
15 stars 0 forks source link

Fibers #6

Open graphitemaster opened 5 years ago

graphitemaster commented 5 years ago

Implement fibers on multiple threads, i.e M:N threading model. In addition, implement all the fiber sync primitives to match the kernel thread ones like mutex, condition variable, etc.

mtwilliams commented 5 years ago

You're going to want to use WaitOnAddress and WakeByAddress{All,Single} on Windows, which isn't available until Windows 8, so you'll need to fallback. I suggest building a hash table of event objects and hashing the addresses to index the table. It'll result in spurious wake ups, but that's expected with futexes anyway.