blob: 8131449eaae5bd3b413e22cc85ff6688113104dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
<!-- ##### SECTION Title ##### -->
cothreads
<!-- ##### SECTION Short_Description ##### -->
userspace threads
<!-- ##### SECTION Long_Description ##### -->
<para>
Cothreads are a simple user-space method for switching between
subtasks. They're based on setjmp()/longjmp() in their current form.
</para>
<para>
Cothreads are used for loop-based elements that pull data instead
of being fed with data. They can also be used to pull a specific region
of data out of their src element.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### MACRO COTHREAD_STACKSIZE ##### -->
<para>
The default stack size of a cothread.
</para>
<!-- ##### MACRO COTHREAD_MAXTHREADS ##### -->
<para>
The maximum number of cothreads we are going to support.
</para>
<!-- ##### MACRO STACK_SIZE ##### -->
<para>
</para>
<!-- ##### MACRO CURRENT_STACK_FRAME ##### -->
<para>
</para>
<!-- ##### STRUCT cothread_state ##### -->
<para>
</para>
@ctx:
@threadnum:
@func:
@argc:
@argv:
@flags:
@sp:
@jmp:
@top_sp:
@pc:
<!-- ##### STRUCT cothread_context ##### -->
<para>
</para>
@threads:
@nthreads:
@current:
@data:
<!-- ##### USER_FUNCTION cothread_func ##### -->
<para>
the function that will be called when the cothread starts. The function
prototype is like a main() function, so you can do whatever you want with
it.
</para>
@argc: a main-like argument count
@argv: a main-like array of arguments
@Returns: a return code
<!-- ##### MACRO COTHREAD_STARTED ##### -->
<para>
Indicates the cothread is started.
</para>
<!-- ##### FUNCTION cothread_init ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION cothread_create ##### -->
<para>
</para>
@ctx:
@Returns:
<!-- ##### FUNCTION cothread_setfunc ##### -->
<para>
</para>
@thread:
@func:
@argc:
@argv:
<!-- ##### FUNCTION cothread_switch ##### -->
<para>
</para>
@thread:
<!-- ##### FUNCTION cothread_getcurrent ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION cothread_main ##### -->
<para>
</para>
@ctx:
@Returns:
<!-- ##### FUNCTION cothread_set_data ##### -->
<para>
</para>
@thread:
@key:
@data:
<!-- ##### FUNCTION cothread_get_data ##### -->
<para>
</para>
@thread:
@key:
@Returns:
|