summaryrefslogtreecommitdiff
path: root/nuttx/sched/atexit.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-01 16:50:53 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-01 16:50:53 +0000
commit43f7ddc7d410a4982ec78cc45cc413a3270d1b52 (patch)
tree6047f392552b62c0d5f6e7aabe95266b5f2ef0cf /nuttx/sched/atexit.c
parent86e0e99187f2074474404662a4e7cee3d2c5f2da (diff)
downloadpx4-nuttx-43f7ddc7d410a4982ec78cc45cc413a3270d1b52.tar.gz
px4-nuttx-43f7ddc7d410a4982ec78cc45cc413a3270d1b52.tar.bz2
px4-nuttx-43f7ddc7d410a4982ec78cc45cc413a3270d1b52.zip
Add __cxa_atexit(); atexit() is now built on top of on_exit()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5292 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/atexit.c')
-rw-r--r--nuttx/sched/atexit.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/nuttx/sched/atexit.c b/nuttx/sched/atexit.c
index f7d81bec2..b0559b01b 100644
--- a/nuttx/sched/atexit.c
+++ b/nuttx/sched/atexit.c
@@ -96,8 +96,13 @@
* CONFIG_SCHED_ATEXIT_MAX defines a larger number.
* 2. atexit functions are not inherited when a new task is
* created.
+ * 3. If both SCHED_ONEXIT and SCHED_ATEXIT are selected, then atexit()
+ * is built on top of the on_exit() implementation. In that case,
+ * CONFIG_SCHED_ONEXIT_MAX determines the size of the combined
+ * number of atexit(0) and on_exit calls and SCHED_ATEXIT_MAX is
+ * not used.
*
- * Parameters:
+ * Input Parameters:
* func - A pointer to the function to be called when the task exits.
*
* Return Value:
@@ -107,7 +112,14 @@
int atexit(void (*func)(void))
{
-#if defined(CONFIG_SCHED_ATEXIT_MAX) && CONFIG_SCHED_ATEXIT_MAX > 1
+#if defined(CONFIG_SCHED_ONEXIT)
+ /* atexit is equivalent to on_exit() with no argument (Assuming that the ABI
+ * can handle a callback function that recieves more parameters than it expects).
+ */
+
+ return on_exit(onexitfunc_t func, NULL);
+
+#elif defined(CONFIG_SCHED_ATEXIT_MAX) && CONFIG_SCHED_ATEXIT_MAX > 1
_TCB *tcb = (_TCB*)g_readytorun.head;
int index;
int ret = ERROR;