diff options
-rw-r--r-- | ot_mutex.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -182,7 +182,7 @@ void mutex_workqueue_canceltask( int64 socket ) { | |||
182 | MTX_DBG( "canceltask unlocked.\n" ); | 182 | MTX_DBG( "canceltask unlocked.\n" ); |
183 | } | 183 | } |
184 | 184 | ||
185 | ot_taskid mutex_workqueue_poptask( ot_tasktype tasktype ) { | 185 | ot_taskid mutex_workqueue_poptask( ot_tasktype *tasktype ) { |
186 | struct ot_task * task; | 186 | struct ot_task * task; |
187 | ot_taskid taskid = 0; | 187 | ot_taskid taskid = 0; |
188 | 188 | ||
@@ -194,13 +194,14 @@ ot_taskid mutex_workqueue_poptask( ot_tasktype tasktype ) { | |||
194 | while( !taskid ) { | 194 | while( !taskid ) { |
195 | /* Skip to the first unassigned task this worker wants to do */ | 195 | /* Skip to the first unassigned task this worker wants to do */ |
196 | task = tasklist; | 196 | task = tasklist; |
197 | while( task && ( task->tasktype != tasktype ) && ( task->taskid ) ) | 197 | while( task && ( ( TASK_MASK & task->tasktype ) != *tasktype ) && ( task->taskid ) ) |
198 | task = task->next; | 198 | task = task->next; |
199 | 199 | ||
200 | /* If we found an outstanding task, assign a taskid to it | 200 | /* If we found an outstanding task, assign a taskid to it |
201 | and leave the loop */ | 201 | and leave the loop */ |
202 | if( task ) { | 202 | if( task ) { |
203 | task->taskid = taskid = ++next_free_taskid; | 203 | task->taskid = taskid = ++next_free_taskid; |
204 | *tasktype = task->tasktype; | ||
204 | } else { | 205 | } else { |
205 | /* Wait until the next task is being fed */ | 206 | /* Wait until the next task is being fed */ |
206 | MTX_DBG( "poptask cond waits.\n" ); | 207 | MTX_DBG( "poptask cond waits.\n" ); |
@@ -231,7 +232,7 @@ int mutex_workqueue_pushresult( ot_taskid taskid, int iovec_entries, struct iove | |||
231 | if( task ) { | 232 | if( task ) { |
232 | task->iovec_entries = iovec_entries; | 233 | task->iovec_entries = iovec_entries; |
233 | task->iovec = iovec; | 234 | task->iovec = iovec; |
234 | task->tasktype = OT_TASKTYPE_DONE; | 235 | task->tasktype = TASK_DONE; |
235 | } | 236 | } |
236 | 237 | ||
237 | /* Release lock */ | 238 | /* Release lock */ |
@@ -253,10 +254,10 @@ int64 mutex_workqueue_popresult( int *iovec_entries, struct iovec ** iovec ) { | |||
253 | MTX_DBG( "popresult locked.\n" ); | 254 | MTX_DBG( "popresult locked.\n" ); |
254 | 255 | ||
255 | task = &tasklist; | 256 | task = &tasklist; |
256 | while( *task && ( (*task)->tasktype != OT_TASKTYPE_DONE ) ) | 257 | while( *task && ( (*task)->tasktype != TASK_DONE ) ) |
257 | task = &(*task)->next; | 258 | task = &(*task)->next; |
258 | 259 | ||
259 | if( *task && ( (*task)->tasktype == OT_TASKTYPE_DONE ) ) { | 260 | if( *task && ( (*task)->tasktype == TASK_DONE ) ) { |
260 | struct ot_task *ptask = *task; | 261 | struct ot_task *ptask = *task; |
261 | 262 | ||
262 | *iovec_entries = (*task)->iovec_entries; | 263 | *iovec_entries = (*task)->iovec_entries; |