diff --git a/aarch64.c b/aarch64.c index 59162f20..b3ffcc49 100644 --- a/aarch64.c +++ b/aarch64.c @@ -59,10 +59,6 @@ static void co_init() { #endif } -const char* co_method() { - return "aarch64"; -} - cothread_t co_active() { if(!co_active_handle) co_active_handle = &co_active_buffer; return co_active_handle; @@ -102,6 +98,10 @@ void co_switch(cothread_t handle) { co_swap(co_active_handle = handle, co_previous_handle); } +int co_serializable() { + return 1; +} + #ifdef __cplusplus } #endif diff --git a/amd64.c b/amd64.c index e9aef889..e9424c0b 100644 --- a/amd64.c +++ b/amd64.c @@ -115,10 +115,6 @@ static void crash() { assert(0); /* called only if cothread_t entrypoint returns */ } -const char* co_method() { - return "amd64"; -} - cothread_t co_active() { if(!co_active_handle) co_active_handle = &co_active_buffer; return co_active_handle; @@ -158,6 +154,10 @@ void co_switch(cothread_t handle) { co_swap(co_active_handle = handle, co_previous_handle); } +int co_serializable() { + return 1; +} + #ifdef __cplusplus } #endif diff --git a/arm.c b/arm.c index 8d872bf5..95adf6b2 100644 --- a/arm.c +++ b/arm.c @@ -35,10 +35,6 @@ static void co_init() { #endif } -const char* co_method() { - return "arm"; -} - cothread_t co_active() { if(!co_active_handle) co_active_handle = &co_active_buffer; return co_active_handle; @@ -77,6 +73,10 @@ void co_switch(cothread_t handle) { co_swap(co_active_handle = handle, co_previous_handle); } +int co_serializable() { + return 1; +} + #ifdef __cplusplus } #endif diff --git a/fiber.c b/fiber.c index f508b0f8..dd539c37 100644 --- a/fiber.c +++ b/fiber.c @@ -16,10 +16,6 @@ static void __stdcall co_thunk(void* coentry) { ((void (*)(void))coentry)(); } -const char* co_method() { - return "fiber"; -} - cothread_t co_active() { if(!co_active_) { ConvertThreadToFiber(0); @@ -50,6 +46,10 @@ void co_switch(cothread_t cothread) { SwitchToFiber(cothread); } +int co_serializable() { + return 0; +} + #ifdef __cplusplus } #endif diff --git a/libco.h b/libco.h index 0b94c2e9..88d00a72 100644 --- a/libco.h +++ b/libco.h @@ -13,12 +13,12 @@ extern "C" { typedef void* cothread_t; -const char* co_method(); cothread_t co_active(); cothread_t co_derive(void*, unsigned int, void (*)(void)); cothread_t co_create(unsigned int, void (*)(void)); void co_delete(cothread_t); void co_switch(cothread_t); +int co_serializable(); #ifdef __cplusplus } diff --git a/ppc.c b/ppc.c index 314997c8..6b7f4acd 100644 --- a/ppc.c +++ b/ppc.c @@ -413,10 +413,6 @@ static void co_init_(void) { co_active_handle = co_create_(state_size, (uintptr_t)&co_switch); } -const char* co_method() { - return "ppc"; -} - cothread_t co_active() { if(!co_active_handle) co_init_(); @@ -429,3 +425,7 @@ void co_switch(cothread_t t) { CO_SWAP_ASM(t, old); } + +int co_serializable() { + return 0; +} diff --git a/ppc64v2.c b/ppc64v2.c index fac464a6..3c296959 100644 --- a/ppc64v2.c +++ b/ppc64v2.c @@ -221,10 +221,6 @@ __asm__( ".size swap_context, .-swap_context\n" ); -const char* co_method() { - return "ppc64v2"; -} - cothread_t co_active() { if(!co_active_handle) { co_active_handle = (struct ppc64_context*)malloc(MIN_STACK + sizeof(struct ppc64_context)); @@ -274,6 +270,10 @@ void co_switch(cothread_t to) { swap_context((struct ppc64_context*)to, from); } +int co_serializable() { + return 1; +} + #ifdef __cplusplus } #endif diff --git a/sjlj.c b/sjlj.c index b4faf17b..5af14729 100644 --- a/sjlj.c +++ b/sjlj.c @@ -33,10 +33,6 @@ static void springboard(int ignored) { } } -const char* co_method() { - return "sjlj"; -} - cothread_t co_active() { if(!co_running) co_running = &co_primary; return (cothread_t)co_running; @@ -140,6 +136,10 @@ void co_switch(cothread_t cothread) { } } +int co_serializable() { + return 0; +} + #ifdef __cplusplus } #endif diff --git a/ucontext.c b/ucontext.c index 49fa976c..5ff76af3 100644 --- a/ucontext.c +++ b/ucontext.c @@ -26,10 +26,6 @@ extern "C" { static thread_local ucontext_t co_primary; static thread_local ucontext_t* co_running = 0; -const char* co_module() { - return "ucontext"; -} - cothread_t co_active() { if(!co_running) co_running = &co_primary; return (cothread_t)co_running; @@ -81,6 +77,10 @@ void co_switch(cothread_t cothread) { swapcontext(old_thread, co_running); } +int co_serializable() { + return 0; +} + #ifdef __cplusplus } #endif diff --git a/x86.c b/x86.c index 8effa0d4..fa1c538f 100644 --- a/x86.c +++ b/x86.c @@ -69,10 +69,6 @@ static void crash() { assert(0); /* called only if cothread_t entrypoint returns */ } -const char* co_method() { - return "x86"; -} - cothread_t co_active() { if(!co_active_handle) co_active_handle = &co_active_buffer; return co_active_handle; @@ -112,6 +108,10 @@ void co_switch(cothread_t handle) { co_swap(co_active_handle = handle, co_previous_handle); } +int co_serializable() { + return 1; +} + #ifdef __cplusplus } #endif