summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrik Sikken <bertrik@sikken.nl>2008-05-28 18:12:13 +0000
committerBertrik Sikken <bertrik@sikken.nl>2008-05-28 18:12:13 +0000
commit5c5e8491962e7de20b74cc7ab61d65d52693de11 (patch)
tree6549950a13304bcfa50f8d46c9b0fd0d989b9d6e
parent06b53321b4a30c6efe1d3cfba5467653cfbfc434 (diff)
downloadrockbox-5c5e8491962e7de20b74cc7ab61d65d52693de11.tar.gz
rockbox-5c5e8491962e7de20b74cc7ab61d65d52693de11.zip
Remove racy call to unregister_ata_idle_func and remove unnecessary check before calling register_ata_idle_func. Should fix FS#8993 - Freeze on shutting down.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17647 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/scrobbler.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/apps/scrobbler.c b/apps/scrobbler.c
index c109439263..a4dd2847ec 100644
--- a/apps/scrobbler.c
+++ b/apps/scrobbler.c
@@ -61,7 +61,6 @@ static int cache_pos;
61static struct mp3entry scrobbler_entry; 61static struct mp3entry scrobbler_entry;
62static bool pending = false; 62static bool pending = false;
63static bool scrobbler_initialised = false; 63static bool scrobbler_initialised = false;
64static bool scrobbler_ata_callback = false;
65#if CONFIG_RTC 64#if CONFIG_RTC
66static time_t timestamp; 65static time_t timestamp;
67#else 66#else
@@ -81,8 +80,6 @@ static void write_cache(void)
81 int i; 80 int i;
82 int fd; 81 int fd;
83 82
84 scrobbler_ata_callback = false;
85
86 /* If the file doesn't exist, create it. 83 /* If the file doesn't exist, create it.
87 Check at each write since file may be deleted at any time */ 84 Check at each write since file may be deleted at any time */
88 if(!file_exists(SCROBBLER_FILE)) 85 if(!file_exists(SCROBBLER_FILE))
@@ -178,11 +175,7 @@ static void add_to_cache(unsigned long play_length)
178 logf("SCROBBLER: %s", scrobbler_entry.path); 175 logf("SCROBBLER: %s", scrobbler_entry.path);
179 } else { 176 } else {
180 cache_pos++; 177 cache_pos++;
181 if (!scrobbler_ata_callback) 178 register_ata_idle_func(scrobbler_flush_callback);
182 {
183 register_ata_idle_func(scrobbler_flush_callback);
184 scrobbler_ata_callback = true;
185 }
186 } 179 }
187 180
188} 181}
@@ -249,14 +242,6 @@ void scrobbler_flush_cache(void)
249 242
250void scrobbler_shutdown(void) 243void scrobbler_shutdown(void)
251{ 244{
252#ifndef SIMULATOR
253 if (scrobbler_ata_callback)
254 {
255 unregister_ata_idle_func(scrobbler_flush_callback, false);
256 scrobbler_ata_callback = false;
257 }
258#endif
259
260 scrobbler_flush_cache(); 245 scrobbler_flush_cache();
261 246
262 if (scrobbler_initialised) 247 if (scrobbler_initialised)