diff options
Diffstat (limited to 'apps/playlist.c')
-rw-r--r-- | apps/playlist.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index 756680c336..c3072ddfd2 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -70,6 +70,7 @@ | |||
70 | #include <string.h> | 70 | #include <string.h> |
71 | #include <ctype.h> | 71 | #include <ctype.h> |
72 | #include "playlist.h" | 72 | #include "playlist.h" |
73 | #include "ata_idle_notify.h" | ||
73 | #include "file.h" | 74 | #include "file.h" |
74 | #include "action.h" | 75 | #include "action.h" |
75 | #include "dir.h" | 76 | #include "dir.h" |
@@ -1255,6 +1256,23 @@ static int compare(const void* p1, const void* p2) | |||
1255 | * without affecting playlist load up performance. This thread also flushes | 1256 | * without affecting playlist load up performance. This thread also flushes |
1256 | * any pending control commands when the disk spins up. | 1257 | * any pending control commands when the disk spins up. |
1257 | */ | 1258 | */ |
1259 | static bool playlist_flush_callback(void) | ||
1260 | { | ||
1261 | struct playlist_info *playlist; | ||
1262 | playlist = ¤t_playlist; | ||
1263 | if (playlist->control_fd >= 0) | ||
1264 | { | ||
1265 | if (playlist->num_cached > 0) | ||
1266 | { | ||
1267 | mutex_lock(&playlist->control_mutex); | ||
1268 | flush_cached_control(playlist); | ||
1269 | mutex_unlock(&playlist->control_mutex); | ||
1270 | } | ||
1271 | sync_control(playlist, true); | ||
1272 | } | ||
1273 | return true; | ||
1274 | } | ||
1275 | |||
1258 | static void playlist_thread(void) | 1276 | static void playlist_thread(void) |
1259 | { | 1277 | { |
1260 | struct queue_event ev; | 1278 | struct queue_event ev; |
@@ -1288,21 +1306,10 @@ static void playlist_thread(void) | |||
1288 | timeout or 5s, whichever is less */ | 1306 | timeout or 5s, whichever is less */ |
1289 | case SYS_TIMEOUT: | 1307 | case SYS_TIMEOUT: |
1290 | playlist = ¤t_playlist; | 1308 | playlist = ¤t_playlist; |
1291 | 1309 | if (playlist->control_fd >= 0) | |
1292 | if (playlist->control_fd >= 0 | ||
1293 | # ifndef SIMULATOR | ||
1294 | && ata_disk_is_active() | ||
1295 | # endif | ||
1296 | ) | ||
1297 | { | 1310 | { |
1298 | if (playlist->num_cached > 0) | 1311 | if (playlist->num_cached > 0) |
1299 | { | 1312 | register_ata_idle_func(playlist_flush_callback); |
1300 | mutex_lock(&playlist->control_mutex); | ||
1301 | flush_cached_control(playlist); | ||
1302 | mutex_unlock(&playlist->control_mutex); | ||
1303 | } | ||
1304 | |||
1305 | sync_control(playlist, true); | ||
1306 | } | 1313 | } |
1307 | 1314 | ||
1308 | if (!dirty_pointers) | 1315 | if (!dirty_pointers) |