Misc improvements from David Hewson

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2697 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2010-05-26 12:34:59 +00:00
parent acf80a964d
commit 07634ecb5d
4 changed files with 21 additions and 7 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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!
*/