From 49ba269b9d09746e90e153f3e245eaf3f97e35cc Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Mon, 19 Nov 2007 21:10:53 +0000 Subject: Cleanup now moved to its own thread, too --- ot_mutex.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'ot_mutex.c') 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 ) { return taskid; } +void mutex_workqueue_pushsuccess( ot_taskid taskid ) { + struct ot_task ** task; + + /* Want exclusive access to tasklist */ + MTX_DBG( "pushsuccess locks.\n" ); + pthread_mutex_lock( &tasklist_mutex ); + MTX_DBG( "pushsuccess locked.\n" ); + + task = &tasklist; + while( *task && ( (*task)->taskid != taskid ) ) + *task = (*task)->next; + + if( *task && ( (*task)->taskid == taskid ) ) { + struct ot_task *ptask = *task; + *task = (*task)->next; + free( ptask ); + } + + /* Release lock */ + MTX_DBG( "pushsuccess unlocks.\n" ); + pthread_mutex_unlock( &tasklist_mutex ); + MTX_DBG( "pushsuccess unlocked.\n" ); +} + int mutex_workqueue_pushresult( ot_taskid taskid, int iovec_entries, struct iovec *iovec ) { struct ot_task * task; /* Want exclusive access to tasklist */ -- cgit v1.2.3