1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
7 <!-- ##### SECTION Long_Description ##### -->
9 Cothreads are a simple user-space method for switching between
10 subtasks. They're based on setjmp()/longjmp() in their current form.
14 Cothreads are used for loop-based elements that pull data instead
15 of being fed with data. They can also be used to pull a specific region
16 of data out of their src element.
19 <!-- ##### SECTION See_Also ##### -->
24 <!-- ##### MACRO CURRENT_STACK_FRAME ##### -->
26 Get the current stack frame.
31 <!-- ##### STRUCT cothread_state ##### -->
49 <!-- ##### STRUCT cothread_context ##### -->
55 <!-- ##### USER_FUNCTION cothread_func ##### -->
57 the function that will be called when the cothread starts. The function
58 prototype is like a main() function, so you can do whatever you want with
62 @argc: a main-like argument count
63 @argv: a main-like array of arguments
64 @Returns: a return code
67 <!-- ##### MACRO COTHREAD_STARTED ##### -->
69 Indicates the cothread is started.
74 <!-- ##### MACRO COTHREAD_DESTROYED ##### -->
76 Indicates the cothread is destroyed.
81 <!-- ##### FUNCTION cothread_context_init ##### -->
89 <!-- ##### FUNCTION cothread_context_free ##### -->
97 <!-- ##### FUNCTION cothread_get_private ##### -->
106 <!-- ##### FUNCTION cothread_set_private ##### -->
115 <!-- ##### FUNCTION cothread_create ##### -->
124 <!-- ##### FUNCTION cothread_free ##### -->
132 <!-- ##### FUNCTION cothread_setfunc ##### -->
143 <!-- ##### FUNCTION cothread_stop ##### -->
151 <!-- ##### FUNCTION cothread_switch ##### -->
159 <!-- ##### FUNCTION cothread_context_get_data ##### -->
169 <!-- ##### FUNCTION cothread_context_set_data ##### -->
179 <!-- ##### FUNCTION cothread_lock ##### -->
187 <!-- ##### FUNCTION cothread_trylock ##### -->
196 <!-- ##### FUNCTION cothread_unlock ##### -->
204 <!-- ##### FUNCTION cothread_main ##### -->
213 <!-- ##### FUNCTION cothread_current_main ##### -->
221 <!-- ##### FUNCTION cothread_current ##### -->