summaryrefslogtreecommitdiff
path: root/nuttx/sched/sched_free.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-11-05 22:58:36 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-11-05 22:58:36 +0000
commit7d5e90d121078be23986be35252a4612d2f39f68 (patch)
treead18d357e3560b507d64f9d64a173f3e2f161ab7 /nuttx/sched/sched_free.c
parent4e4e59b8d249ed809a8a97072f0f7efcbaf4bc89 (diff)
downloadpx4-nuttx-7d5e90d121078be23986be35252a4612d2f39f68.tar.gz
px4-nuttx-7d5e90d121078be23986be35252a4612d2f39f68.tar.bz2
px4-nuttx-7d5e90d121078be23986be35252a4612d2f39f68.zip
Incorporate the work thread
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2230 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/sched_free.c')
-rw-r--r--nuttx/sched/sched_free.c64
1 files changed, 37 insertions, 27 deletions
diff --git a/nuttx/sched/sched_free.c b/nuttx/sched/sched_free.c
index 6078cc1b6..afa5e62c9 100644
--- a/nuttx/sched/sched_free.c
+++ b/nuttx/sched/sched_free.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sched_free.c
+/************************************************************************
+ * sched/sched_free.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -31,55 +31,59 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ************************************************************************/
-/************************************************************
+/************************************************************************
* Included Files
- ************************************************************/
+ ************************************************************************/
+#include <nuttx/config.h>
#include <sys/types.h>
-#include <nuttx/kmalloc.h>
+
#include <queue.h>
#include <assert.h>
+
+#include <nuttx/kmalloc.h>
#include <nuttx/arch.h>
+#include <nuttx/wqueue.h>
#include <nuttx/mm.h>
+
#include "os_internal.h"
-/************************************************************
+/************************************************************************
* Definitions
- ************************************************************/
+ ************************************************************************/
-/************************************************************
+/************************************************************************
* Private Type Declarations
- ************************************************************/
+ ************************************************************************/
-/************************************************************
+/************************************************************************
* Global Variables
- ************************************************************/
+ ************************************************************************/
-/************************************************************
+/************************************************************************
* Private Variables
- ************************************************************/
+ ************************************************************************/
-/************************************************************
+/************************************************************************
* Private Function Prototypes
- ************************************************************/
+ ************************************************************************/
-/************************************************************
+/************************************************************************
* Public Functions
- ************************************************************/
+ ************************************************************************/
-/************************************************************
+/************************************************************************
* Name: sched_free
*
* Description:
- * This function performs deallocations that
- * the operating system may need to make. This special
- * interface to free is used to handling corner cases
- * where the operating system may have to perform deallocations
- * from within an interrupt handler.
+ * This function performs deallocations that the operating system may
+ * need to make. This special interface to free is used to handling
+ * corner cases where the operating system may have to perform
+ * deallocations from within an interrupt handler.
*
- ************************************************************/
+ ************************************************************************/
void sched_free(FAR void *address)
{
@@ -95,6 +99,12 @@ void sched_free(FAR void *address)
irqstate_t saved_state = irqsave();
sq_addlast((FAR sq_entry_t*)address, (sq_queue_t*)&g_delayeddeallocations);
+
+ /* Signal the worker thread that is has some clean up to do */
+
+#ifdef CONFIG_SCHED_WORKQUEUE
+ work_signal();
+#endif
irqrestore(saved_state);
}
else