summaryrefslogtreecommitdiff
path: root/nuttx/sched/work_cancel.c
diff options
context:
space:
mode:
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;
}