| 327 | cs_fiber_ucontext_t *prev_ctx = nullptr; |
| 328 | |
| 329 | static void entry() noexcept |
| 330 | { |
| 331 | unix_fiber *fi = static_cast<unix_fiber *>(current_process->fiber_stack.top().get()); |
| 332 | try { |
| 333 | fi->state = fiber_state::running; |
| 334 | var ret = fi->func(); |
| 335 | fi->ret_val.swap(ret); |
| 336 | } |
| 337 | catch (...) { |
| 338 | fi->eptr = std::current_exception(); |
| 339 | } |
| 340 | fi->state = fiber_state::finished; |
| 341 | cs_fiber_swapcontext(&fi->ctx, fi->prev_ctx); |
| 342 | // This should never execute |
| 343 | std::abort(); |
| 344 | } |
| 345 | |
| 346 | public: |
| 347 | unix_fiber() = delete; |