Beispiel #1
0
void hb_rotate_close( hb_filter_private_t * pv )
{
    if( !pv )
    {
        return;
    }

    /* Cleanup frame buffers */
    if( pv->buf_out )
    {
        hb_buffer_close( &pv->buf_out );
    }
    if (pv->buf_settings )
    {
        hb_buffer_close( &pv->buf_settings );
    }

    int i;
    for( i = 0; i < pv->cpu_count; i++)
    {
        /*
         * Tell each rotate thread to stop, and then cleanup.
         */
        pv->rotate_arguments[i].stop = 1;
        hb_unlock(  pv->rotate_begin_lock[i] );
    
        hb_thread_close( &pv->rotate_threads[i] );
        hb_lock_close( &pv->rotate_begin_lock[i] );
        hb_lock_close( &pv->rotate_complete_lock[i] );
    }
    
    /*
     * free memory for rotate structs
     */
    free( pv->rotate_threads );
    free( pv->rotate_begin_lock );
    free( pv->rotate_complete_lock );
    free( pv->rotate_arguments );

    free( pv );
}
Beispiel #2
0
void
taskset_fini( taskset_t *ts )
{
    int i;

    hb_lock( ts->task_cond_lock );
    /*
     * Tell each thread to stop, and then cleanup.
     */
    bit_nset( ts->task_stop_bitmap, 0, ts->thread_count - 1 );
    bit_nset( ts->task_begin_bitmap, 0, ts->thread_count - 1 );
    hb_cond_broadcast( ts->task_begin );

    /*
     * Wait for all threads to exit.
     */
    hb_cond_wait( ts->task_complete, ts->task_cond_lock );
    hb_unlock( ts->task_cond_lock );

    /*
     * Clean up taskset memory.
     */
    for( i = 0; i < ts->thread_count; i++)
    {
        hb_thread_close( &ts->task_threads[i] );
    }
    hb_lock_close( &ts->task_cond_lock );
    hb_cond_close( &ts->task_begin );
    hb_cond_close( &ts->task_complete );
    free( ts->task_threads );
    if( ts->task_threads_args != NULL )
        free( ts->task_threads_args );
    free( ts->task_begin_bitmap );
    free( ts->task_complete_bitmap );
    free( ts->task_stop_bitmap );
}