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.tar.gz
rockbox-e4c0ef35fc40728fe81acf4828147ed1299dacda.zip
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 df68022fcd..4facbb8ab2 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)
136static struct travel_data dir_recursion[MAX_SCAN_DEPTH]; 136static struct travel_data dir_recursion[MAX_SCAN_DEPTH];
137 137
138/** 138/**
139 * Returns true if there is an event waiting in the queue
140 * that requires the current operation to be aborted.
141 */
142static bool check_event_queue(void)
143{
144 struct event ev;
145
146 queue_wait_w_tmo(&dircache_queue, &ev, 0);
147 switch (ev.id)
148 {
149 case DIRCACHE_STOP:
150 case SYS_USB_CONNECTED:
151 /* Put the event back into the queue. */
152 queue_post(&dircache_queue, ev.id, ev.data);
153 return true;
154 }
155
156 return false;
157}
158
159/**
139 * Internal function to iterate a path. 160 * Internal function to iterate a path.
140 */ 161 */
141static int dircache_scan(struct travel_data *td) 162static int dircache_scan(struct travel_data *td)
@@ -145,7 +166,7 @@ static int dircache_scan(struct travel_data *td)
145 if (thread_enabled) 166 if (thread_enabled)
146 { 167 {
147 /* Stop if we got an external signal. */ 168 /* Stop if we got an external signal. */
148 if (!queue_empty(&dircache_queue)) 169 if (check_event_queue())
149 return -6; 170 return -6;
150 yield(); 171 yield();
151 } 172 }