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
This commit is contained in:
Miika Pekkarinen 2006-03-22 17:09:13 +00:00
parent e2824c94fc
commit e4c0ef35fc

View file

@ -135,6 +135,27 @@ static struct dircache_entry* dircache_gen_down(struct dircache_entry *ce)
#define MAX_SCAN_DEPTH 16
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.
*/
@ -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();
}