summaryrefslogtreecommitdiff
path: root/ot_mutex.c
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2007-11-19 21:10:53 +0000
committerDirk Engling <erdgeist@erdgeist.org>2007-11-19 21:10:53 +0000
commit032224f15002f5d33f055b1ddf7e1ae03c239e12 (patch)
treef4847038b777d85dccc3f0ac594ef28d88f4ec40 /ot_mutex.c
parent7b6b26e7ca2b8fe83c144a054c607798bd2a9a04 (diff)
downloadopentracker-032224f15002f5d33f055b1ddf7e1ae03c239e12.tar.gz
opentracker-032224f15002f5d33f055b1ddf7e1ae03c239e12.zip
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 ) {
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 */