… | |
… | |
95 | |
95 | |
96 | typedef aio_cb *aio_req; |
96 | typedef aio_cb *aio_req; |
97 | typedef aio_cb *aio_req_ornot; |
97 | typedef aio_cb *aio_req_ornot; |
98 | |
98 | |
99 | enum { |
99 | enum { |
100 | PRI_MIN = 4, |
100 | PRI_MIN = -4, |
101 | PRI_MAX = -4, |
101 | PRI_MAX = 4, |
102 | |
102 | |
103 | DEFAULT_PRI = 0, |
103 | DEFAULT_PRI = 0, |
104 | PRI_BIAS = PRI_MIN, |
104 | PRI_BIAS = -PRI_MIN, |
105 | }; |
105 | }; |
106 | |
106 | |
107 | static int next_pri = DEFAULT_PRI + PRI_BIAS; |
107 | static int next_pri = DEFAULT_PRI + PRI_BIAS; |
108 | |
108 | |
109 | static int started, wanted; |
109 | static int started, wanted; |
… | |
… | |
191 | } |
191 | } |
192 | } |
192 | } |
193 | |
193 | |
194 | static void poll_wait () |
194 | static void poll_wait () |
195 | { |
195 | { |
|
|
196 | fd_set rfd; |
|
|
197 | |
196 | while (nreqs) |
198 | while (nreqs) |
197 | { |
199 | { |
198 | aio_req req; |
200 | aio_req req; |
199 | pthread_mutex_lock (&reslock); |
201 | pthread_mutex_lock (&reslock); |
200 | req = ress; |
202 | req = ress; |
201 | pthread_mutex_unlock (&reslock); |
203 | pthread_mutex_unlock (&reslock); |
202 | |
204 | |
203 | if (req) |
205 | if (req) |
204 | return; |
206 | return; |
205 | |
207 | |
206 | fd_set rfd; |
|
|
207 | FD_ZERO(&rfd); |
208 | FD_ZERO(&rfd); |
208 | FD_SET(respipe [0], &rfd); |
209 | FD_SET(respipe [0], &rfd); |
209 | |
210 | |
210 | select (respipe [0] + 1, &rfd, 0, 0, 0); |
211 | select (respipe [0] + 1, &rfd, 0, 0, 0); |
211 | } |
212 | } |
… | |
… | |
1260 | #if 0 |
1261 | #if 0 |
1261 | |
1262 | |
1262 | void |
1263 | void |
1263 | aio_pri (int pri = DEFAULT_PRI) |
1264 | aio_pri (int pri = DEFAULT_PRI) |
1264 | CODE: |
1265 | CODE: |
1265 | if (pri > PRI_MIN) pri = PRI_MIN; |
1266 | if (pri < PRI_MIN) pri = PRI_MIN; |
1266 | if (pri < PRI_MAX) pri = PRI_MAX; |
1267 | if (pri > PRI_MAX) pri = PRI_MAX; |
1267 | next_pri = pri + PRI_BIAS; |
1268 | next_pri = pri + PRI_BIAS; |
1268 | |
1269 | |
1269 | #endif |
1270 | #endif |
1270 | |
1271 | |
1271 | void |
1272 | void |