… | |
… | |
88 | volatile void *arg = coro_init_arg; |
88 | volatile void *arg = coro_init_arg; |
89 | |
89 | |
90 | coro_transfer (new_coro, create_coro); |
90 | coro_transfer (new_coro, create_coro); |
91 | |
91 | |
92 | #if __GCC_HAVE_DWARF2_CFI_ASM && __amd64 |
92 | #if __GCC_HAVE_DWARF2_CFI_ASM && __amd64 |
93 | asm (".cfi_startproc"); |
93 | /*asm (".cfi_startproc");*/ |
94 | asm (".cfi_undefined rip"); |
94 | /*asm (".cfi_undefined rip");*/ |
95 | #endif |
95 | #endif |
96 | |
96 | |
97 | func ((void *)arg); |
97 | func ((void *)arg); |
98 | |
98 | |
99 | #if __GCC_HAVE_DWARF2_CFI_ASM && __amd64 |
99 | #if __GCC_HAVE_DWARF2_CFI_ASM && __amd64 |
100 | asm (".cfi_endproc"); |
100 | /*asm (".cfi_endproc");*/ |
101 | #endif |
101 | #endif |
102 | |
102 | |
103 | /* the new coro returned. bad. just abort() for now */ |
103 | /* the new coro returned. bad. just abort() for now */ |
104 | abort (); |
104 | abort (); |
105 | } |
105 | } |
… | |
… | |
594 | coro_destroy (coro_context *ctx) |
594 | coro_destroy (coro_context *ctx) |
595 | { |
595 | { |
596 | if (!pthread_equal (ctx->id, null_tid)) |
596 | if (!pthread_equal (ctx->id, null_tid)) |
597 | { |
597 | { |
598 | pthread_cancel (ctx->id); |
598 | pthread_cancel (ctx->id); |
599 | pthread_mutex_unlock (&coro_mutex); |
599 | pthread_mutex_unlock (&coro_mutex); /* let the other coro run */ |
600 | pthread_join (ctx->id, 0); |
600 | pthread_join (ctx->id, 0); |
601 | pthread_mutex_lock (&coro_mutex); |
601 | pthread_mutex_lock (&coro_mutex); |
602 | } |
602 | } |
603 | |
603 | |
604 | pthread_cond_destroy (&ctx->cv); |
604 | pthread_cond_destroy (&ctx->cv); |