| 428 | } |
| 429 | |
| 430 | void yield() |
| 431 | { |
| 432 | if (current_process->fiber_stack.empty()) |
| 433 | throw lang_error("Cannot yield outside a fiber."); |
| 434 | unix_fiber *fi = static_cast<unix_fiber *>(current_process->fiber_stack.top().get()); |
| 435 | fi->state = fiber_state::suspended; |
| 436 | cs_fiber_swapcontext(&fi->ctx, fi->prev_ctx); |
| 437 | } |
| 438 | } // namespace fiber |
| 439 | |
| 440 | namespace dll { |
no test coverage detected