aboutsummaryrefslogtreecommitdiff
path: root/nuttx/include
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-01-31 23:39:12 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-01-31 23:39:12 +0000
commit35a1f247c44339eb39ae20b85b575d2e6e61a0cc (patch)
tree4ec59e18f087faba4945cf1bb1d7855d44e82080 /nuttx/include
parented4ee27f70c63909417a8854668a8fe057a971ff (diff)
downloadpx4-firmware-35a1f247c44339eb39ae20b85b575d2e6e61a0cc.tar.gz
px4-firmware-35a1f247c44339eb39ae20b85b575d2e6e61a0cc.tar.bz2
px4-firmware-35a1f247c44339eb39ae20b85b575d2e6e61a0cc.zip
Add on_exit(); Re-order some logic in the task shutdown sequence. Sometimes some complex logic needs to execute when closing file descriptors and this needs to happen early while the task is still healthy
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4354 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/include')
-rw-r--r--nuttx/include/nuttx/sched.h16
-rw-r--r--nuttx/include/stdlib.h11
2 files changed, 20 insertions, 7 deletions
diff --git a/nuttx/include/nuttx/sched.h b/nuttx/include/nuttx/sched.h
index 7d5fe16bf..4cfca9dbc 100644
--- a/nuttx/include/nuttx/sched.h
+++ b/nuttx/include/nuttx/sched.h
@@ -133,12 +133,16 @@ union entry_u
};
typedef union entry_u entry_t;
-/* This is the type of the function that is executed with exit() is called
- * (if registered via atexit()).
+/* These is the types of the functions that are executed with exit() is called
+ * (if registered via atexit() on on_exit()).
*/
#ifdef CONFIG_SCHED_ATEXIT
-typedef void (*exitfunc_t)(void);
+typedef void (*atexitfunc_t)(void);
+#endif
+
+#ifdef CONFIG_SCHED_ONEXIT
+typedef void (*onexitfunc_t)(int, FAR void *)
#endif
/* POSIX Message queue */
@@ -185,7 +189,11 @@ struct _TCB
start_t start; /* Thread start function */
entry_t entry; /* Entry Point into the thread */
#ifdef CONFIG_SCHED_ATEXIT
- exitfunc_t exitfunc; /* Called if exit is called. */
+ atexitfunc_t atexitfunc; /* Called if exit is called. */
+#endif
+#ifdef CONFIG_SCHED_ONEXIT
+ onexitfunc_t onexitfunc; /* Called if exit is called. */
+ FAR void *onexitarg; /* The argument passed to the function */
#endif
#ifdef CONFIG_SCHED_WAITPID /* Experimental */
sem_t exitsem; /* Support for waitpid */
diff --git a/nuttx/include/stdlib.h b/nuttx/include/stdlib.h
index b9b9346b5..27696e0fa 100644
--- a/nuttx/include/stdlib.h
+++ b/nuttx/include/stdlib.h
@@ -1,8 +1,8 @@
/****************************************************************************
* include/stdlib.h
*
- * Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -132,7 +132,12 @@ EXTERN int unsetenv(const char *name);
EXTERN void exit(int status) noreturn_function;
EXTERN void abort(void) noreturn_function;
-EXTERN int atexit(void (*func)(void));
+#ifdef CONFIG_SCHED_ATEXIT
+EXTERN int atexit(CODE void (*func)(void));
+#endif
+#ifdef CONFIG_SCHED_ONEXIT
+EXTERN int on_exit(CODE void (*func)(int, FAR void *), FAR void *arg);
+#endif
/* String to binary conversions */