iceshard-engine / engine

A personal game engine project, with development focus towards 2D/2.5D games.
https://www.iceshard.net/engine
MIT License
38 stars 3 forks source link

Optimization Idea: Skipping synchronization if thread not changed. #162

Open Dandielo opened 1 year ago

Dandielo commented 1 year ago

Sometimes we might have a situation where the Awaitable responsible to move a task to a different execution thread is already in the "ready" state, skipping all the necessary work. It would be great to notify functions like wait_for that there never was a thread change and the synchronization can be minimalized. (For example, not invoking the futex call on Unix / Android systems)