… | |
… | |
85 | * 2016-08-27 try to disable _FORTIFY_SOURCE with CORO_SJLJ, as it |
85 | * 2016-08-27 try to disable _FORTIFY_SOURCE with CORO_SJLJ, as it |
86 | * breaks setjmp/longjmp. Also disable CORO_ASM for asm by default, |
86 | * breaks setjmp/longjmp. Also disable CORO_ASM for asm by default, |
87 | * as it was reported to crash. |
87 | * as it was reported to crash. |
88 | * 2016-11-18 disable cfi_undefined again - backtraces might be worse, but |
88 | * 2016-11-18 disable cfi_undefined again - backtraces might be worse, but |
89 | * compile compatibility is improved. |
89 | * compile compatibility is improved. |
|
|
90 | * 2018-08-14 use a completely different pthread strategy that should allow |
|
|
91 | * sharing of coroutines among different threads. this would |
|
|
92 | * undefined behaviour before as mutexes would be unlocked on |
|
|
93 | * a different thread. overall, this might be slower than |
|
|
94 | * using a pipe for synchronisation, but pipes eat fd's... |
90 | */ |
95 | */ |
91 | |
96 | |
92 | #ifndef CORO_H |
97 | #ifndef CORO_H |
93 | #define CORO_H |
98 | #define CORO_H |
94 | |
99 | |
… | |
… | |
404 | |
409 | |
405 | extern pthread_mutex_t coro_mutex; |
410 | extern pthread_mutex_t coro_mutex; |
406 | |
411 | |
407 | struct coro_context |
412 | struct coro_context |
408 | { |
413 | { |
|
|
414 | int flags; |
409 | pthread_cond_t cv; |
415 | pthread_cond_t cv; |
410 | pthread_t id; |
|
|
411 | }; |
416 | }; |
412 | |
417 | |
413 | void coro_transfer (coro_context *prev, coro_context *next); |
418 | void coro_transfer (coro_context *prev, coro_context *next); |
414 | void coro_destroy (coro_context *ctx); |
419 | void coro_destroy (coro_context *ctx); |
415 | |
420 | |