summaryrefslogtreecommitdiff
path: root/ot_mutex.c
diff options
context:
space:
mode:
authorerdgeist <>2007-11-18 16:46:34 +0000
committererdgeist <>2007-11-18 16:46:34 +0000
commit9cd6e355be8b4e8a0af92d3d06511303e71c1cac (patch)
tree9d99f6ccc45f1e2087be8913a9d91b685aa58d38 /ot_mutex.c
parent44a674c9df7e7d00636d5d1e6f256c18a39e198f (diff)
Reflect new task-classes model in mutex queue
Diffstat (limited to 'ot_mutex.c')
-rw-r--r--ot_mutex.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/ot_mutex.c b/ot_mutex.c
index 649d3c8..a08b5ef 100644
--- a/ot_mutex.c
+++ b/ot_mutex.c
@@ -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
185ot_taskid mutex_workqueue_poptask( ot_tasktype tasktype ) { 185ot_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;