… | |
… | |
222 | static volatile unsigned int nreqs; /* reqlock */ |
222 | static volatile unsigned int nreqs; /* reqlock */ |
223 | static volatile unsigned int nready; /* reqlock */ |
223 | static volatile unsigned int nready; /* reqlock */ |
224 | static volatile unsigned int npending; /* reqlock */ |
224 | static volatile unsigned int npending; /* reqlock */ |
225 | static volatile unsigned int max_idle = 4; |
225 | static volatile unsigned int max_idle = 4; |
226 | |
226 | |
227 | static mutex_t wrklock = X_MUTEX_INIT; |
227 | static xmutex_t wrklock = X_MUTEX_INIT; |
228 | static mutex_t reslock = X_MUTEX_INIT; |
228 | static xmutex_t reslock = X_MUTEX_INIT; |
229 | static mutex_t reqlock = X_MUTEX_INIT; |
229 | static xmutex_t reqlock = X_MUTEX_INIT; |
230 | static cond_t reqwait = X_COND_INIT; |
230 | static xcond_t reqwait = X_COND_INIT; |
231 | |
231 | |
232 | #if !HAVE_PREADWRITE |
232 | #if !HAVE_PREADWRITE |
233 | /* |
233 | /* |
234 | * make our pread/pwrite emulation safe against themselves, but not against |
234 | * make our pread/pwrite emulation safe against themselves, but not against |
235 | * normal read/write by using a mutex. slows down execution a lot, |
235 | * normal read/write by using a mutex. slows down execution a lot, |
236 | * but that's your problem, not mine. |
236 | * but that's your problem, not mine. |
237 | */ |
237 | */ |
238 | static mutex_t preadwritelock = X_MUTEX_INIT; |
238 | static xmutex_t preadwritelock = X_MUTEX_INIT; |
239 | #endif |
239 | #endif |
240 | |
240 | |
241 | typedef struct etp_worker |
241 | typedef struct etp_worker |
242 | { |
242 | { |
243 | /* locked by wrklock */ |
243 | /* locked by wrklock */ |
244 | struct etp_worker *prev, *next; |
244 | struct etp_worker *prev, *next; |
245 | |
245 | |
246 | thread_t tid; |
246 | xthread_t tid; |
247 | |
247 | |
248 | /* locked by reslock, reqlock or wrklock */ |
248 | /* locked by reslock, reqlock or wrklock */ |
249 | ETP_REQ *req; /* currently processed request */ |
249 | ETP_REQ *req; /* currently processed request */ |
250 | |
250 | |
251 | ETP_WORKER_COMMON |
251 | ETP_WORKER_COMMON |