summaryrefslogtreecommitdiff
path: root/nuttx/sched/work_cancel.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-05-26 12:34:59 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-05-26 12:34:59 +0000
commit46c3539ddb30d90081b5561bba669a20eb1ea077 (patch)
treea6d49490af9a178cd3fd67d4a43ad317d6995a6f /nuttx/sched/work_cancel.c
parent294d4dbe5569da304b28880c07953cb169dca1a0 (diff)
downloadpx4-nuttx-46c3539ddb30d90081b5561bba669a20eb1ea077.tar.gz
px4-nuttx-46c3539ddb30d90081b5561bba669a20eb1ea077.tar.bz2
px4-nuttx-46c3539ddb30d90081b5561bba669a20eb1ea077.zip
Misc improvements from David Hewson
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2697 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/work_cancel.c')
-rwxr-xr-xnuttx/sched/work_cancel.c13
1 files changed, 9 insertions, 4 deletions
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;
}