diff options
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/sched/os_start.c | 7 | ||||
-rwxr-xr-x | nuttx/sched/work_cancel.c | 13 | ||||
-rwxr-xr-x | nuttx/sched/work_queue.c | 2 | ||||
-rwxr-xr-x | nuttx/sched/work_thread.c | 6 |
4 files changed, 21 insertions, 7 deletions
diff --git a/nuttx/sched/os_start.c b/nuttx/sched/os_start.c index 3c25b7008..78b1c7997 100644 --- a/nuttx/sched/os_start.c +++ b/nuttx/sched/os_start.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/os_start.c * - * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -436,9 +436,14 @@ void os_start(void) /* Start the worker thread that will perform misc garbage clean-up */ #ifdef CONFIG_SCHED_WORKQUEUE +#ifndef CONFIG_CUSTOM_STACK g_worker = task_create("work", CONFIG_SCHED_WORKPRIORITY, CONFIG_SCHED_WORKSTACKSIZE, (main_t)work_thread, (const char **)NULL); +#else + g_worker = task_create("work", CONFIG_SCHED_WORKPRIORITY, + (main_t)work_thread, (const char **)NULL); +#endif ASSERT(g_worker != ERROR); #endif diff --git a/nuttx/sched/work_cancel.c b/nuttx/sched/work_cancel.c index 9ef43994b..f110eb4cc 100755 --- a/nuttx/sched/work_cancel.c +++ b/nuttx/sched/work_cancel.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/work_cancel.c * - * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -102,9 +102,14 @@ int work_cancel(struct work_s *work) */ flags = irqsave(); - DEBUGASSERT(work->dq.flink || (FAR dq_entry_t *)work == g_work.head); - DEBUGASSERT(work->dq.blink || (FAR dq_entry_t *)work == g_work.tail); - dq_rem((FAR dq_entry_t *)work, &g_work); + if (work->worker != NULL) + { + DEBUGASSERT(work->dq.flink || (FAR dq_entry_t *)work == g_work.head); + DEBUGASSERT(work->dq.blink || (FAR dq_entry_t *)work == g_work.tail); + dq_rem((FAR dq_entry_t *)work, &g_work); + + work->worker = NULL; + } irqrestore(flags); return OK; } diff --git a/nuttx/sched/work_queue.c b/nuttx/sched/work_queue.c index aa4d48889..dc371a136 100755 --- a/nuttx/sched/work_queue.c +++ b/nuttx/sched/work_queue.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/work_queue.c * - * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without diff --git a/nuttx/sched/work_thread.c b/nuttx/sched/work_thread.c index 56673c9f0..bbf6a3bb1 100755 --- a/nuttx/sched/work_thread.c +++ b/nuttx/sched/work_thread.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/work_thread.c * - * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -160,6 +160,10 @@ int work_thread(int argc, char *argv[]) worker = work->worker; arg = work->arg; + /* Mark the work as no longer being queued */ + + work->worker = NULL; + /* Do the work. Re-enable interrupts while the work is being * performed... we don't have any idea how long that will take! */ |