This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compile with clang or MSVC (WINDOWS ONLY RN) | |
// | |
// Implementing a POC green threads system using safepoints to show how cheap and simple it can | |
// be done, all you need to do is call SAFEPOINT_POLL in your own language at the top of every | |
// loop and function body (you can loosen up on this depending on the latency of pausing you're | |
// willing to pay). Safepoint polling is made cheap because it's a load without a use site | |
// which means it doesn't introduce a stall and pays a sub-cycle cost because of it (wastes resources | |
// sure but doesn't block up the rest of execution). | |
// | |
// # safepoint poll |
OlderNewer