This commit is contained in:
byuu 2019-10-20 01:14:04 +09:00
parent ef1d4b592a
commit 0d87e92a10
10 changed files with 37 additions and 37 deletions

View File

@ -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

View File

@ -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

8
arm.c
View File

@ -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

View File

@ -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

View File

@ -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
}

8
ppc.c
View File

@ -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;
}

View File

@ -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

8
sjlj.c
View File

@ -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

View File

@ -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

8
x86.c
View File

@ -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