| 120 | //============================================================================= |
| 121 | |
| 122 | class CoroutineRuntimeStub : public ICoroutineRuntime { |
| 123 | public: |
| 124 | void pumpCoroutines(fl::u32 us) FL_NOEXCEPT override { |
| 125 | fl::detail::CoroutineRunner::instance().run(us); |
| 126 | } |
| 127 | |
| 128 | void suspendMainthread(fl::u32 us) FL_NOEXCEPT override { |
| 129 | // Stub coroutines are std::threads — calling CoroutineRunner::run() |
| 130 | // from a worker thread would deadlock on the two-phase semaphore handoff. |
| 131 | // Instead, just sleep for the requested duration (safe from any thread). |
| 132 | fl::this_thread::sleep_for(fl::chrono::microseconds(us)); // ok sleep for |
| 133 | } |
| 134 | }; |
| 135 | |
| 136 | //============================================================================= |
| 137 | // Task Coroutine — std::thread-based |