aboutsummaryrefslogtreecommitdiff
path: root/nuttx/sched/atexit.c
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2013-01-11 02:14:43 -0800
committerpx4dev <px4@purgatory.org>2013-01-11 02:14:43 -0800
commitf127495caa2d45a1b1fff3be7a9d3756259d23e2 (patch)
tree91daf599eae326f2207d0fbd9ede34b51eca1812 /nuttx/sched/atexit.c
parent48c5d63319be3b8da7c4cd598d2a31dceae842a7 (diff)
downloadpx4-firmware-f127495caa2d45a1b1fff3be7a9d3756259d23e2.tar.gz
px4-firmware-f127495caa2d45a1b1fff3be7a9d3756259d23e2.tar.bz2
px4-firmware-f127495caa2d45a1b1fff3be7a9d3756259d23e2.zip
Manually fixup merge botches via direct comparison with NuttX r5447.
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;