Fix atexit() function being called twice

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4644 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2012-04-23 13:59:31 +00:00
parent 4cae5aee9f
commit 09eac48792
7 changed files with 99 additions and 7 deletions

View File

@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
<p>Last Updated: April 14, 2012</p>
<p>Last Updated: April 23, 2012</p>
</td>
</tr>
</table>
@ -2228,10 +2228,13 @@
<td>
<p>
<b>PIC32MX795F512L</b>.
This port uses the Microchip PIC32 Ethernet Starter Kit (DM320004) with the Expansion I/O board.
See the <a href="http://ww.microchip.com">Microchip website</a> for further information.
There one two board ports using this chip:
</p>
<ul>
<li><b>Microchip PIC32 Ethernet Starter Kit</b>.
This port uses the Microchip PIC32 Ethernet Starter Kit (DM320004) with the Expansion I/O board.
See the <a href="http://ww.microchip.com">Microchip website</a> for further information.
</li>
<p>
<b>STATUS:</b>
This port was started and then shelved for some time until I received the Expansion I/O board.
@ -2243,6 +2246,14 @@
Also included are a a verified Ethernet driver, a partially verified USB device controller driver, and an unverifed SPI driver.
Stay tuned for updates.
</p>
<li><b>Mikroelektronika PIC32MX7 Mulitmedia Board (MMB)</b>.
A port has begun for the Mikroelektronika PIC32MX7 Multimedia Board (MMB).
See http://www.mikroe.com/ for further information.
</li>
<p>
<b>STATUS:</b>
A configuration exists for this board, but has not been verfied as of this writing.
</p>
</ul>
</td>
</tr>

View File

@ -522,6 +522,12 @@ And the UNIX interface:
The task is first terminated and then reinitialized with same
ID, priority, original entry point, stack size, and parameters
it had when it was first started.
</p>
<p>
NOTE: The normal task exit clean up is not performed.
For example, file descriptors are not closed;
any files opened prior to the restart will remain opened after the task is restarted.
</p>
<p>
<b>Input Parameters:</b>
<ul>

View File

@ -1467,6 +1467,13 @@ config USART1_2STOP
---help---
Two stop bits
config USART1_RXDMA
bool "USART1 Rx DMA"
default n
depends on STM32_STM32F40XX && ARCH_DMA && STM32_DMA2
---help---
In high data rate usage, Rx DMA may eliminate Rx overrun errors
endmenu
menu "USART2 Configuration"
@ -1516,6 +1523,13 @@ config USART2_2STOP
---help---
Two stop bits
config USART2_RXDMA
bool "USART2 Rx DMA"
default n
depends on STM32_STM32F40XX && ARCH_DMA && STM32_DMA1
---help---
In high data rate usage, Rx DMA may eliminate Rx overrun errors
endmenu
menu "USART3 Configuration"
@ -1565,6 +1579,13 @@ config USART3_2STOP
---help---
Two stop bits
config USART3_RXDMA
bool "USART3 Rx DMA"
default n
depends on STM32_STM32F40XX && ARCH_DMA && STM32_DMA1
---help---
In high data rate usage, Rx DMA may eliminate Rx overrun errors
endmenu
menu "UART4 Configuration"
@ -1614,6 +1635,13 @@ config USART4_2STOP
---help---
Two stop bits
config USART4_RXDMA
bool "USART4 Rx DMA"
default n
depends on STM32_STM32F40XX && ARCH_DMA && STM32_DMA1
---help---
In high data rate usage, Rx DMA may eliminate Rx overrun errors
endmenu
menu "UART5 Configuration"
@ -1663,6 +1691,13 @@ config USART5_2STOP
---help---
Two stop bits
config USART5_RXDMA
bool "USART5 Rx DMA"
default n
depends on STM32_STM32F40XX && ARCH_DMA && STM32_DMA1
---help---
In high data rate usage, Rx DMA may eliminate Rx overrun errors
endmenu
menu "USART6 Configuration"
@ -1712,6 +1747,13 @@ config USART6_2STOP
---help---
Two stop bits
config USART6_RXDMA
bool "USART6 Rx DMA"
default n
depends on STM32_STM32F40XX && ARCH_DMA && STM32_DMA2
---help---
In high data rate usage, Rx DMA may eliminate Rx overrun errors
endmenu
menu "SPI Configuration"

View File

@ -1495,9 +1495,6 @@ configs/pic32mx7mmb
This directory will (eventually) contain the port of NuttX to the
Mikroelektronika PIC32MX7 Multimedia Board (MMB). See
http://www.mikroe.com/ for further information.
On initial check-in, this directory is just a clone of the PIC32 starter
kit port with the appropriate naming changes. More to come.
configs/pjrc-8051
8051 Microcontroller. This port uses the PJRC 87C52 development system

View File

@ -2,7 +2,7 @@ configs/pic32mx7mmb README
===============================
This README file discusses the port of NuttX to the Mikroelektronika PIC32MX7
Multimedia Board (MMB)
Multimedia Board (MMB). See http://www.mikroe.com/ for further information.
Contents
========

View File

@ -83,6 +83,21 @@
* This function causes a specified task to cease to exist. Its stack and
* TCB will be deallocated. This function is the companion to task_create().
*
* The logic in this function only deletes non-running tasks. If the 'pid'
* parameter refers to to the currently runing task, then processing is
* redirected to exit().
*
* Control will still be returned to task_delete() after the exit() logic
* finishes. In fact, this function is the final function called all task
* termination sequences. Here are all possible exit scenarios:
*
* - pthread_exit(). Calls exit()
* - exit(). Calls _exit()
* - _exit(). Calls task_deletecurrent() making the currently running task
* non-running then calls task_delete() to terminate the non-running
* task.
* - task_delete()
*
* Inputs:
* pid - The task ID of the task to delete. A pid of zero
* signifies the calling task.
@ -145,6 +160,9 @@ int task_delete(pid_t pid)
* this as early as possible so that higher level clean-up logic
* can run in a healthy tasking environment.
*
* In the case where the task exits via exit(), task_exithook()
* may be called twice.
*
* I suppose EXIT_SUCCESS is an appropriate return value???
*/

View File

@ -114,14 +114,32 @@ void task_exithook(FAR _TCB *tcb, int status)
#ifdef CONFIG_SCHED_ATEXIT
if (tcb->atexitfunc)
{
/* Call the atexit function */
(*tcb->atexitfunc)();
/* Nullify the atexit function. task_exithook may be called more then
* once in most task exit scenarios. Nullifying the atext function
* pointer will assure that the callback is performed only once.
*/
tcb->atexitfunc = NULL;
}
#endif
#ifdef CONFIG_SCHED_ONEXIT
if (tcb->onexitfunc)
{
/* Call the on_exit function */
(*tcb->onexitfunc)(status, tcb->onexitarg);
/* Nullify the on_exit function. task_exithook may be called more then
* once in most task exit scenarios. Nullifying the on_exit function
* pointer will assure that the callback is performed only once.
*/
tcb->onexitfunc = NULL;
}
#endif