1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Bertrik Sikken 2008-05-28 18:12:13 +00:00
parent 06b53321b4
commit 5c5e849196

View file

@ -61,7 +61,6 @@ static int cache_pos;
static struct mp3entry scrobbler_entry; static struct mp3entry scrobbler_entry;
static bool pending = false; static bool pending = false;
static bool scrobbler_initialised = false; static bool scrobbler_initialised = false;
static bool scrobbler_ata_callback = false;
#if CONFIG_RTC #if CONFIG_RTC
static time_t timestamp; static time_t timestamp;
#else #else
@ -81,8 +80,6 @@ static void write_cache(void)
int i; int i;
int fd; int fd;
scrobbler_ata_callback = false;
/* If the file doesn't exist, create it. /* If the file doesn't exist, create it.
Check at each write since file may be deleted at any time */ Check at each write since file may be deleted at any time */
if(!file_exists(SCROBBLER_FILE)) if(!file_exists(SCROBBLER_FILE))
@ -178,11 +175,7 @@ static void add_to_cache(unsigned long play_length)
logf("SCROBBLER: %s", scrobbler_entry.path); logf("SCROBBLER: %s", scrobbler_entry.path);
} else { } else {
cache_pos++; cache_pos++;
if (!scrobbler_ata_callback) register_ata_idle_func(scrobbler_flush_callback);
{
register_ata_idle_func(scrobbler_flush_callback);
scrobbler_ata_callback = true;
}
} }
} }
@ -249,14 +242,6 @@ void scrobbler_flush_cache(void)
void scrobbler_shutdown(void) void scrobbler_shutdown(void)
{ {
#ifndef SIMULATOR
if (scrobbler_ata_callback)
{
unregister_ata_idle_func(scrobbler_flush_callback, false);
scrobbler_ata_callback = false;
}
#endif
scrobbler_flush_cache(); scrobbler_flush_cache();
if (scrobbler_initialised) if (scrobbler_initialised)