1 /*
2   libco
3   version: 0.17 (2015-06-18)
4   author: byuu
5   license: public domain
6 */
7 
8 #ifndef LIBCO_H
9 #define LIBCO_H
10 
11 #ifdef LIBCO_C
12   #ifdef LIBCO_MP
13     #define thread_local __thread
14   #else
15     #define thread_local
16   #endif
17 
18   #if defined(_MSC_VER)
19    /* Untested */
20    #define force_text_section __declspec(allocate(".text"))
21   #elif defined(__APPLE__) && defined(__MACH__)
22    #define force_text_section __attribute__((section("__TEXT,__text")))
23   #else
24    #define force_text_section __attribute__((section(".text")))
25   #endif
26 #endif
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 typedef void* cothread_t;
33 
34 cothread_t co_active();
35 cothread_t co_create(unsigned int, void (*)(void));
36 void co_delete(cothread_t);
37 void co_switch(cothread_t);
38 
39 #ifdef __cplusplus
40 }
41 #endif
42 
43 /* ifndef LIBCO_H */
44 #endif
45