summaryrefslogtreecommitdiff
path: root/ot_mutex.c
diff options
context:
space:
mode:
authorerdgeist <>2007-11-19 21:10:53 +0000
committererdgeist <>2007-11-19 21:10:53 +0000
commit49ba269b9d09746e90e153f3e245eaf3f97e35cc (patch)
treef4847038b777d85dccc3f0ac594ef28d88f4ec40 /ot_mutex.c
parent3528752c7b82d23b4cf9331a6df56e2cc8db9239 (diff)
Cleanup now moved to its own thread, too
Diffstat (limited to 'ot_mutex.c')
-rw-r--r--ot_mutex.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/ot_mutex.c b/ot_mutex.c
index a08b5ef..b01bb4a 100644
--- a/ot_mutex.c
+++ b/ot_mutex.c
@@ -218,6 +218,30 @@ ot_taskid mutex_workqueue_poptask( ot_tasktype *tasktype ) {
218 return taskid; 218 return taskid;
219} 219}
220 220
221void 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
221int mutex_workqueue_pushresult( ot_taskid taskid, int iovec_entries, struct iovec *iovec ) { 245int 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 */