MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / taskset_fini

Function taskset_fini

libhb/taskset.c:209–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207
208
209void
210taskset_fini( taskset_t *ts )
211{
212 if (ts == NULL)
213 {
214 return;
215 }
216
217 int i;
218 if ( ts->task_thread_started ) {
219 /*
220 * Tell each thread to stop, and then cleanup.
221 */
222 for ( i = 0; i < ts->thread_count; i++ )
223 {
224 taskset_thread_t *thread = taskset_thread( ts, i );
225 hb_lock( thread->lock );
226 thread->begin = 1;
227 thread->stop = 1;
228 hb_cond_signal( thread->begin_cond );
229 while ( !thread->complete ) {
230 hb_cond_wait( thread->complete_cond, thread->lock );
231 }
232 hb_unlock( thread->lock );
233 }
234 /*
235 * Clean up thread memory.
236 */
237 for( i = 0; i < ts->thread_count; i++ )
238 {
239 taskset_thread_t *thread = taskset_thread( ts, i );
240 hb_thread_close( &thread->thread );
241 }
242 }
243
244 /*
245 * Clean up taskset memory.
246 */
247 for( i = 0; i < ts->thread_count; i++ )
248 {
249 taskset_thread_t *thread = taskset_thread( ts, i );
250 hb_lock_close( &thread->lock );
251 hb_cond_close( &thread->begin_cond );
252 hb_cond_close( &thread->complete_cond );
253 }
254
255 free( ts->task_threads );
256
257 if( ts->task_threads_args != NULL )
258 free( ts->task_threads_args );
259}

Callers 6

comb_detect_closeFunction · 0.85
hb_decomb_closeFunction · 0.85
nlmeans_initFunction · 0.85
nlmeans_closeFunction · 0.85
mt_frame_initFunction · 0.85
mt_frame_closeFunction · 0.85

Calls 8

taskset_threadFunction · 0.85
hb_lockFunction · 0.85
hb_cond_signalFunction · 0.85
hb_cond_waitFunction · 0.85
hb_unlockFunction · 0.85
hb_thread_closeFunction · 0.85
hb_lock_closeFunction · 0.85
hb_cond_closeFunction · 0.85

Tested by

no test coverage detected