Commit d38bce2c authored by Steven Walters's avatar Steven Walters Committed by Fiona Glaser

Fix extremely rare deadlock with sync-lookahead

Patch partially by Anton Mitrofanov.
parent c86a6de2
......@@ -1958,8 +1958,10 @@ int x264_encoder_encode( x264_t *h,
else
{
/* signal kills for lookahead thread */
x264_pthread_mutex_lock( &h->lookahead->ifbuf.mutex );
h->lookahead->b_exit_thread = 1;
x264_pthread_cond_broadcast( &h->lookahead->ifbuf.cv_fill );
x264_pthread_mutex_unlock( &h->lookahead->ifbuf.mutex );
}
h->i_frame++;
......
......@@ -166,8 +166,10 @@ void x264_lookahead_delete( x264_t *h )
{
if( h->param.i_sync_lookahead )
{
x264_pthread_mutex_lock( &h->lookahead->ifbuf.mutex );
h->lookahead->b_exit_thread = 1;
x264_pthread_cond_broadcast( &h->lookahead->ifbuf.cv_fill );
x264_pthread_mutex_unlock( &h->lookahead->ifbuf.mutex );
x264_pthread_join( h->thread[h->param.i_threads]->thread_handle, NULL );
x264_macroblock_cache_end( h->thread[h->param.i_threads] );
x264_free( h->thread[h->param.i_threads] );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment