diff options
Diffstat (limited to 'ot_mutex.c')
-rw-r--r-- | ot_mutex.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -218,6 +218,30 @@ ot_taskid mutex_workqueue_poptask( ot_tasktype *tasktype ) { | |||
218 | return taskid; | 218 | return taskid; |
219 | } | 219 | } |
220 | 220 | ||
221 | void mutex_workqueue_pushsuccess( ot_taskid taskid ) { | ||
222 | struct ot_task ** task; | ||
223 | |||
224 | /* Want exclusive access to tasklist */ | ||
225 | MTX_DBG( "pushsuccess locks.\n" ); | ||
226 | pthread_mutex_lock( &tasklist_mutex ); | ||
227 | MTX_DBG( "pushsuccess locked.\n" ); | ||
228 | |||
229 | task = &tasklist; | ||
230 | while( *task && ( (*task)->taskid != taskid ) ) | ||
231 | *task = (*task)->next; | ||
232 | |||
233 | if( *task && ( (*task)->taskid == taskid ) ) { | ||
234 | struct ot_task *ptask = *task; | ||
235 | *task = (*task)->next; | ||
236 | free( ptask ); | ||
237 | } | ||
238 | |||
239 | /* Release lock */ | ||
240 | MTX_DBG( "pushsuccess unlocks.\n" ); | ||
241 | pthread_mutex_unlock( &tasklist_mutex ); | ||
242 | MTX_DBG( "pushsuccess unlocked.\n" ); | ||
243 | } | ||
244 | |||
221 | int mutex_workqueue_pushresult( ot_taskid taskid, int iovec_entries, struct iovec *iovec ) { | 245 | int mutex_workqueue_pushresult( ot_taskid taskid, int iovec_entries, struct iovec *iovec ) { |
222 | struct ot_task * task; | 246 | struct ot_task * task; |
223 | /* Want exclusive access to tasklist */ | 247 | /* Want exclusive access to tasklist */ |