| 223 | } |
| 224 | |
| 225 | void Yield() |
| 226 | { |
| 227 | do { |
| 228 | // Dispatch anything in the queue, added while there were no Services |
| 229 | { |
| 230 | auto guard = std::lock_guard{ sActionsMutex }; |
| 231 | std::vector<Action> actions; |
| 232 | actions.swap(sActions); |
| 233 | for (auto &action : actions) |
| 234 | action(); |
| 235 | } |
| 236 | |
| 237 | // Dispatch according to Services, if present |
| 238 | if (auto p = Get()) |
| 239 | p->DoYield(); |
| 240 | } |
| 241 | // Re-test for more actions that might have been enqueued by actions just |
| 242 | // dispatched |
| 243 | while ( !sActions.empty() ); |
| 244 | } |
| 245 | |
| 246 | void ProcessIdle() |
| 247 | { |
no test coverage detected