/* Clean up all peers in current bucket, remove timedout pools and torrents */ static void * clean_worker( void * args ) { args = args; while( 1 ) { ot_tasktype tasktype = TASK_CLEAN; ot_taskid taskid = mutex_workqueue_poptask( &tasktype ); clean_make( ); mutex_workqueue_pushsuccess( taskid ); } return NULL; }
static void * stats_worker( void * args ) { int iovec_entries; struct iovec *iovector; (void) args; while( 1 ) { ot_tasktype tasktype = TASK_STATS; ot_taskid taskid = mutex_workqueue_poptask( &tasktype ); stats_make( &iovec_entries, &iovector, tasktype ); if( mutex_workqueue_pushresult( taskid, iovec_entries, iovector ) ) iovec_free( &iovec_entries, &iovector ); } return NULL; }
/* This is the entry point into this worker thread It grabs tasks from mutex_tasklist and delivers results back */ static void * fullscrape_worker( void * args ) { int iovec_entries; struct iovec *iovector; (void) args; while( 1 ) { ot_tasktype tasktype = TASK_FULLSCRAPE; ot_taskid taskid = mutex_workqueue_poptask( &tasktype ); fullscrape_make( &iovec_entries, &iovector, tasktype ); if( mutex_workqueue_pushresult( taskid, iovec_entries, iovector ) ) iovec_free( &iovec_entries, &iovector ); if( !g_opentracker_running ) return NULL; } return NULL; }