summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2006-03-22 17:09:13 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2006-03-22 17:09:13 +0000
commite4c0ef35fc40728fe81acf4828147ed1299dacda (patch)
treed74c22b5384273a6860c26afaf5b04eb1c54a3e8
parente2824c94fc5a8cb0e60554351f0b69f3df4b46fb (diff)
downloadrockbox-e4c0ef35fc40728fe81acf4828147ed1299dacda.zip
rockbox-e4c0ef35fc40728fe81acf4828147ed1299dacda.tar.gz
rockbox-e4c0ef35fc40728fe81acf4828147ed1299dacda.tar.bz2
rockbox-e4c0ef35fc40728fe81acf4828147ed1299dacda.tar.xz
Don't stop dircache thread when charger is plugged in/removed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9193 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/common/dircache.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c
index df68022..4facbb8 100644
--- a/firmware/common/dircache.c
+++ b/firmware/common/dircache.c
@@ -136,6 +136,27 @@ static struct dircache_entry* dircache_gen_down(struct dircache_entry *ce)
static struct travel_data dir_recursion[MAX_SCAN_DEPTH];
/**
+ * Returns true if there is an event waiting in the queue
+ * that requires the current operation to be aborted.
+ */
+static bool check_event_queue(void)
+{
+ struct event ev;
+
+ queue_wait_w_tmo(&dircache_queue, &ev, 0);
+ switch (ev.id)
+ {
+ case DIRCACHE_STOP:
+ case SYS_USB_CONNECTED:
+ /* Put the event back into the queue. */
+ queue_post(&dircache_queue, ev.id, ev.data);
+ return true;
+ }
+
+ return false;
+}
+
+/**
* Internal function to iterate a path.
*/
static int dircache_scan(struct travel_data *td)
@@ -145,7 +166,7 @@ static int dircache_scan(struct travel_data *td)
if (thread_enabled)
{
/* Stop if we got an external signal. */
- if (!queue_empty(&dircache_queue))
+ if (check_event_queue())
return -6;
yield();
}