Mercurial > audlegacy
changeset 3463:dfa487a14b3c trunk audacious-1.4.0-dr3
Automated merge with ssh://hg.atheme.org//hg/audacious
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Sun, 09 Sep 2007 00:07:39 -0500 |
parents | 84e62bfb695e (current diff) 95a607e527f2 (diff) |
children | 01d0d353b579 |
files | |
diffstat | 3 files changed, 29 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/playlist.c Sun Sep 09 00:07:33 2007 -0500 +++ b/src/audacious/playlist.c Sun Sep 09 00:07:39 2007 -0500 @@ -45,11 +45,11 @@ #include <sys/errno.h> #if defined(USE_REGEX_ONIGURUMA) - #include <onigposix.h> +# include <onigposix.h> #elif defined(USE_REGEX_PCRE) - #include <pcreposix.h> +# include <pcreposix.h> #else - #include <regex.h> +# include <regex.h> #endif #include "input.h" @@ -102,11 +102,11 @@ * January 7, 2006, William Pitcock <nenolod@nenolod.net> */ -G_LOCK_DEFINE(playlist_get_info_going); //static gchar *playlist_current_name = NULL; static gboolean playlist_get_info_scan_active = FALSE; +GStaticRWLock playlist_get_info_rwlock = G_STATIC_RW_LOCK_INIT; static gboolean playlist_get_info_going = FALSE; static GThread *playlist_get_info_thread; @@ -411,11 +411,8 @@ } void -playlist_clear(Playlist *playlist) +playlist_clear_only(Playlist *playlist) { - if (!playlist) - return; - PLAYLIST_LOCK( playlist->mutex ); g_list_foreach(playlist->entries, (GFunc) playlist_entry_free, NULL); @@ -426,7 +423,15 @@ playlist->attribute = PLAYLIST_PLAIN; PLAYLIST_UNLOCK( playlist->mutex ); - +} + +void +playlist_clear(Playlist *playlist) +{ + if (!playlist) + return; + + playlist_clear_only(playlist); playlist_generate_shuffle_list(playlist); playlistwin_update_list(playlist); playlist_recalc_total_time(playlist); @@ -2505,13 +2510,14 @@ { gboolean result; - G_LOCK(playlist_get_info_going); + g_static_rw_lock_reader_lock(&playlist_get_info_rwlock); result = playlist_get_info_going; - G_UNLOCK(playlist_get_info_going); + g_static_rw_lock_reader_unlock(&playlist_get_info_rwlock); return result; } + static gboolean playlist_request_win_update(gpointer unused) { @@ -2520,6 +2526,7 @@ return FALSE; /* to be called only once */ } + static gpointer playlist_get_info_func(gpointer arg) { @@ -2531,8 +2538,7 @@ Playlist *playlist = playlist_get_active(); // on_load - if (cfg.use_pl_metadata && - cfg.get_info_on_load && + if (cfg.use_pl_metadata && cfg.get_info_on_load && playlist_get_info_scan_active) { for (node = playlist->entries; node; node = g_list_next(node)) { @@ -2599,9 +2605,8 @@ } } } // on_demand - else if (cfg.get_info_on_demand && - (!cfg.playlist_visible || cfg.playlist_shaded - || !cfg.use_pl_metadata)) + else if (cfg.get_info_on_demand && + (!cfg.playlist_visible || cfg.playlist_shaded || !cfg.use_pl_metadata)) { g_mutex_lock(mutex_scan); playlist_get_info_scan_active = FALSE; @@ -2639,9 +2644,9 @@ void playlist_start_get_info_thread(void) { - G_LOCK(playlist_get_info_going); + g_static_rw_lock_writer_lock(&playlist_get_info_rwlock); playlist_get_info_going = TRUE; - G_UNLOCK(playlist_get_info_going); + g_static_rw_lock_writer_unlock(&playlist_get_info_rwlock); playlist_get_info_thread = g_thread_create(playlist_get_info_func, NULL, TRUE, NULL); @@ -2650,9 +2655,9 @@ void playlist_stop_get_info_thread(void) { - G_LOCK(playlist_get_info_going); + g_static_rw_lock_writer_lock(&playlist_get_info_rwlock); playlist_get_info_going = FALSE; - G_UNLOCK(playlist_get_info_going); + g_static_rw_lock_writer_unlock(&playlist_get_info_rwlock); g_cond_broadcast(cond_scan); g_thread_join(playlist_get_info_thread); @@ -2664,6 +2669,7 @@ g_mutex_lock(mutex_scan); playlist_get_info_scan_active = TRUE; g_mutex_unlock(mutex_scan); + g_cond_signal(cond_scan); } @@ -3241,7 +3247,6 @@ { g_mutex_free( playlist->mutex ); g_free( playlist ); - return; } Playlist *
--- a/src/audacious/playlist.h Sun Sep 09 00:07:33 2007 -0500 +++ b/src/audacious/playlist.h Sun Sep 09 00:07:39 2007 -0500 @@ -126,6 +126,7 @@ void playlist_select_prev(void); GList * playlist_get_playlists(void); +void playlist_clear_only(Playlist *playlist); void playlist_clear(Playlist *playlist); void playlist_delete(Playlist *playlist, gboolean crop);
--- a/src/audacious/ui_main.c Sun Sep 09 00:07:33 2007 -0500 +++ b/src/audacious/ui_main.c Sun Sep 09 00:07:39 2007 -0500 @@ -406,6 +406,8 @@ { GList *playlists = NULL, *playlists_top = NULL; + playlist_stop_get_info_thread(); + gtk_widget_hide(equalizerwin); gtk_widget_hide(playlistwin); gtk_widget_hide(mainwin); @@ -417,7 +419,6 @@ plugin_system_cleanup(); - playlist_stop_get_info_thread(); /* free and clear each playlist */ playlists = playlist_get_playlists();