Mercurial > audlegacy
comparison src/audacious/playlist.c @ 3467:5a6896b6000f trunk
Implement playlist_get_info_scanning() with mutex locking.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 09 Sep 2007 21:36:42 +0300 |
parents | 0fcff78c0c2c |
children | 440877c9360e |
comparison
equal
deleted
inserted
replaced
3466:6ceb4439c6a0 | 3467:5a6896b6000f |
---|---|
2517 return result; | 2517 return result; |
2518 } | 2518 } |
2519 | 2519 |
2520 | 2520 |
2521 static gboolean | 2521 static gboolean |
2522 playlist_get_info_scanning(void) | |
2523 { | |
2524 gboolean result; | |
2525 | |
2526 g_mutex_lock(mutex_scan); | |
2527 result = playlist_get_info_scan_active; | |
2528 g_mutex_unlock(mutex_scan); | |
2529 | |
2530 return result; | |
2531 } | |
2532 | |
2533 | |
2534 static gboolean | |
2522 playlist_request_win_update(gpointer unused) | 2535 playlist_request_win_update(gpointer unused) |
2523 { | 2536 { |
2524 Playlist *playlist = playlist_get_active(); | 2537 Playlist *playlist = playlist_get_active(); |
2525 playlistwin_update_list(playlist); | 2538 playlistwin_update_list(playlist); |
2526 return FALSE; /* to be called only once */ | 2539 return FALSE; /* to be called only once */ |
2537 PlaylistEntry *entry; | 2550 PlaylistEntry *entry; |
2538 Playlist *playlist = playlist_get_active(); | 2551 Playlist *playlist = playlist_get_active(); |
2539 | 2552 |
2540 // on_load | 2553 // on_load |
2541 if (cfg.use_pl_metadata && cfg.get_info_on_load && | 2554 if (cfg.use_pl_metadata && cfg.get_info_on_load && |
2542 playlist_get_info_scan_active) { | 2555 playlist_get_info_scanning()) { |
2543 | 2556 |
2544 for (node = playlist->entries; node; node = g_list_next(node)) { | 2557 for (node = playlist->entries; node; node = g_list_next(node)) { |
2545 entry = node->data; | 2558 entry = node->data; |
2546 | 2559 |
2547 if(playlist->attribute & PLAYLIST_STATIC || | 2560 if(playlist->attribute & PLAYLIST_STATIC || |
2625 instead, schedule a playlist update in the main loop --giacomo */ | 2638 instead, schedule a playlist update in the main loop --giacomo */ |
2626 g_idle_add_full(G_PRIORITY_HIGH_IDLE, playlist_request_win_update, NULL, NULL); | 2639 g_idle_add_full(G_PRIORITY_HIGH_IDLE, playlist_request_win_update, NULL, NULL); |
2627 update_playlistwin = FALSE; | 2640 update_playlistwin = FALSE; |
2628 } | 2641 } |
2629 | 2642 |
2630 if (playlist_get_info_scan_active) { | 2643 if (playlist_get_info_scanning()) { |
2631 continue; | 2644 continue; |
2632 } | 2645 } |
2633 | 2646 |
2634 g_mutex_lock(mutex_scan); | 2647 g_mutex_lock(mutex_scan); |
2635 g_cond_wait(cond_scan, mutex_scan); | 2648 g_cond_wait(cond_scan, mutex_scan); |
3243 } | 3256 } |
3244 | 3257 |
3245 void | 3258 void |
3246 playlist_free(Playlist *playlist) | 3259 playlist_free(Playlist *playlist) |
3247 { | 3260 { |
3261 if (!playlist) | |
3262 return; | |
3263 | |
3248 g_mutex_free( playlist->mutex ); | 3264 g_mutex_free( playlist->mutex ); |
3249 g_free( playlist ); | 3265 g_free( playlist ); |
3250 } | 3266 } |
3251 | 3267 |
3252 Playlist * | 3268 Playlist * |