aboutsummaryrefslogtreecommitdiff
path: root/nuttx/include
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-08-01 17:47:54 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-08-01 17:47:54 +0000
commit20324504d5997b2ddad85ec3bfa91544c09edd2a (patch)
tree9226c125b2583f72f45393934b2571f2600fee49 /nuttx/include
parent8a4cf655d73899d4a6bac46c2ef762e0e9344ede (diff)
downloadpx4-firmware-20324504d5997b2ddad85ec3bfa91544c09edd2a.tar.gz
px4-firmware-20324504d5997b2ddad85ec3bfa91544c09edd2a.tar.bz2
px4-firmware-20324504d5997b2ddad85ec3bfa91544c09edd2a.zip
atexit() and on_exit() may now be configured to support multiple exit callbacks
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4995 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/include')
-rw-r--r--nuttx/include/nuttx/sched.h24
-rw-r--r--nuttx/include/sys/syscall.h11
2 files changed, 30 insertions, 5 deletions
diff --git a/nuttx/include/nuttx/sched.h b/nuttx/include/nuttx/sched.h
index 90e54706d..241af6210 100644
--- a/nuttx/include/nuttx/sched.h
+++ b/nuttx/include/nuttx/sched.h
@@ -188,18 +188,32 @@ struct _TCB
pid_t pid; /* This is the ID of the thread */
start_t start; /* Thread start function */
entry_t entry; /* Entry Point into the thread */
+
#ifdef CONFIG_SCHED_ATEXIT
- atexitfunc_t atexitfunc; /* Called if exit is called. */
+# if defined(CONFIG_SCHED_ATEXIT_MAX) && CONFIG_SCHED_ATEXIT_MAX > 1
+ atexitfunc_t atexitfunc[CONFIG_SCHED_ATEXIT_MAX];
+# else
+ atexitfunc_t atexitfunc; /* Called when exit is called. */
+# endif
#endif
+
#ifdef CONFIG_SCHED_ONEXIT
- onexitfunc_t onexitfunc; /* Called if exit is called. */
+# if defined(CONFIG_SCHED_ONEXIT_MAX) && CONFIG_SCHED_ONEXIT_MAX > 1
+ onexitfunc_t onexitfunc[CONFIG_SCHED_ONEXIT_MAX];
+ FAR void *onexitarg[CONFIG_SCHED_ONEXIT_MAX];
+# else
+ onexitfunc_t onexitfunc; /* Called when exit is called. */
FAR void *onexitarg; /* The argument passed to the function */
+# endif
#endif
-#ifdef CONFIG_SCHED_WAITPID /* Experimental */
+
+#ifdef CONFIG_SCHED_WAITPID
sem_t exitsem; /* Support for waitpid */
int *stat_loc; /* Location to return exit status */
#endif
+
uint8_t sched_priority; /* Current priority of the thread */
+
#ifdef CONFIG_PRIORITY_INHERITANCE
# if CONFIG_SEM_NNESTPRIO > 0
uint8_t npend_reprio; /* Number of nested reprioritizations */
@@ -207,12 +221,15 @@ struct _TCB
# endif
uint8_t base_priority; /* "Normal" priority of the thread */
#endif
+
uint8_t task_state; /* Current state of the thread */
uint16_t flags; /* Misc. general status flags */
int16_t lockcount; /* 0=preemptable (not-locked) */
+
#ifndef CONFIG_DISABLE_PTHREAD
FAR void *joininfo; /* Detach-able info to support join */
#endif
+
#if CONFIG_RR_INTERVAL > 0
int timeslice; /* RR timeslice interval remaining */
#endif
@@ -221,6 +238,7 @@ struct _TCB
uint8_t init_priority; /* Initial priority of the task */
char *argv[CONFIG_MAX_TASK_ARGS+1]; /* Name+start-up parameters */
+
#ifndef CONFIG_DISABLE_ENVIRON
FAR environ_t *envp; /* Environment variables */
#endif
diff --git a/nuttx/include/sys/syscall.h b/nuttx/include/sys/syscall.h
index 96650eaea..57545beb7 100644
--- a/nuttx/include/sys/syscall.h
+++ b/nuttx/include/sys/syscall.h
@@ -97,9 +97,16 @@
#ifdef CONFIG_SCHED_ATEXIT
# define SYS_atexit __SYS_atexit
-# define __SYS_waitpaid (__SYS_atexit+1)
+# define __SYS_onexit (__SYS_atexit+1)
#else
-# define __SYS_waitpaid __SYS_atexit
+# define __SYS_onexit __SYS_atexit
+#endif
+
+#ifdef CONFIG_SCHED_ONEXIT
+# define SYS_onexit __SYS_onexit
+# define __SYS_waitpaid (__SYS_onexit+1)
+#else
+# define __SYS_waitpaid __SYS_onexit
#endif
#ifdef CONFIG_SCHED_WAITPID