Commit 21724f58 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Signal the playlist BEFORE unlocking it.

One should never signal a condition without the corresponding lock:
 "if predictable scheduling behavior is required, then that mutex shall
  be locked    by    the    thread   calling   pthread_cond_broadcast()
  or pthread_cond_signal()." -- POSIX

This only fixes the most obvious cases. There might be others.
parent 8440f6c0
...@@ -184,8 +184,8 @@ int playlist_PreparseEnqueue( playlist_t *p_playlist, ...@@ -184,8 +184,8 @@ int playlist_PreparseEnqueue( playlist_t *p_playlist,
p_playlist->p_preparse->i_waiting, p_playlist->p_preparse->i_waiting,
p_playlist->p_preparse->i_waiting, p_playlist->p_preparse->i_waiting,
p_item ); p_item );
vlc_mutex_unlock( &p_playlist->p_preparse->object_lock );
vlc_cond_signal( &p_playlist->p_preparse->object_wait ); vlc_cond_signal( &p_playlist->p_preparse->object_wait );
vlc_mutex_unlock( &p_playlist->p_preparse->object_lock );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -218,8 +218,8 @@ int playlist_AskForArtEnqueue( playlist_t *p_playlist, ...@@ -218,8 +218,8 @@ int playlist_AskForArtEnqueue( playlist_t *p_playlist,
INSERT_ELEM( p_playlist->p_fetcher->p_waiting, INSERT_ELEM( p_playlist->p_fetcher->p_waiting,
p_playlist->p_fetcher->i_waiting, p_playlist->p_fetcher->i_waiting,
i, p ); i, p );
vlc_mutex_unlock( &p_playlist->p_fetcher->object_lock );
vlc_cond_signal( &p_playlist->p_fetcher->object_wait ); vlc_cond_signal( &p_playlist->p_fetcher->object_wait );
vlc_mutex_unlock( &p_playlist->p_fetcher->object_lock );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -544,8 +544,8 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj ) ...@@ -544,8 +544,8 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
INSERT_ELEM( p_playlist->p_fetcher->p_waiting, INSERT_ELEM( p_playlist->p_fetcher->p_waiting,
p_playlist->p_fetcher->i_waiting, p_playlist->p_fetcher->i_waiting,
p_playlist->p_fetcher->i_waiting, p); p_playlist->p_fetcher->i_waiting, p);
vlc_mutex_unlock( &p_playlist->p_fetcher->object_lock );
vlc_cond_signal( &p_playlist->p_fetcher->object_wait ); vlc_cond_signal( &p_playlist->p_fetcher->object_wait );
vlc_mutex_unlock( &p_playlist->p_fetcher->object_lock );
} }
/* We already have all needed meta, but we need art right now */ /* We already have all needed meta, but we need art right now */
else if( p_playlist->p_fetcher->i_art_policy == ALBUM_ART_ALL && else if( p_playlist->p_fetcher->i_art_policy == ALBUM_ART_ALL &&
...@@ -559,8 +559,8 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj ) ...@@ -559,8 +559,8 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
INSERT_ELEM( p_playlist->p_fetcher->p_waiting, INSERT_ELEM( p_playlist->p_fetcher->p_waiting,
p_playlist->p_fetcher->i_waiting, p_playlist->p_fetcher->i_waiting,
p_playlist->p_fetcher->i_waiting, p); p_playlist->p_fetcher->i_waiting, p);
vlc_mutex_unlock( &p_playlist->p_fetcher->object_lock );
vlc_cond_signal( &p_playlist->p_fetcher->object_wait ); vlc_cond_signal( &p_playlist->p_fetcher->object_wait );
vlc_mutex_unlock( &p_playlist->p_fetcher->object_lock );
} }
else else
{ {
......
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