Browse Source

Fix atexit() function being called twice

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4644 7fd9a85b-ad96-42d3-883c-3090e2eb8679
sbg
patacongo 13 years ago
parent
commit
09eac48792
  1. 17
      nuttx/Documentation/NuttX.html
  2. 6
      nuttx/Documentation/NuttxUserGuide.html
  3. 42
      nuttx/arch/arm/src/stm32/Kconfig
  4. 3
      nuttx/configs/README.txt
  5. 2
      nuttx/configs/pic32mx7mmb/README.txt
  6. 18
      nuttx/sched/task_delete.c
  7. 18
      nuttx/sched/task_exithook.c

17
nuttx/Documentation/NuttX.html

@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4"> <tr align="center" bgcolor="#e4e4e4">
<td> <td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1> <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> </td>
</tr> </tr>
</table> </table>
@ -2228,10 +2228,13 @@
<td> <td>
<p> <p>
<b>PIC32MX795F512L</b>. <b>PIC32MX795F512L</b>.
This port uses the Microchip PIC32 Ethernet Starter Kit (DM320004) with the Expansion I/O board. There one two board ports using this chip:
See the <a href="http://ww.microchip.com">Microchip website</a> for further information.
</p> </p>
<ul> <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> <p>
<b>STATUS:</b> <b>STATUS:</b>
This port was started and then shelved for some time until I received the Expansion I/O board. 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. Also included are a a verified Ethernet driver, a partially verified USB device controller driver, and an unverifed SPI driver.
Stay tuned for updates. Stay tuned for updates.
</p> </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> </ul>
</td> </td>
</tr> </tr>

6
nuttx/Documentation/NuttxUserGuide.html

@ -522,6 +522,12 @@ And the UNIX interface:
The task is first terminated and then reinitialized with same The task is first terminated and then reinitialized with same
ID, priority, original entry point, stack size, and parameters ID, priority, original entry point, stack size, and parameters
it had when it was first started. 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> <p>
<b>Input Parameters:</b> <b>Input Parameters:</b>
<ul> <ul>

42
nuttx/arch/arm/src/stm32/Kconfig

@ -1467,6 +1467,13 @@ config USART1_2STOP
---help--- ---help---
Two stop bits 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 endmenu
menu "USART2 Configuration" menu "USART2 Configuration"
@ -1516,6 +1523,13 @@ config USART2_2STOP
---help--- ---help---
Two stop bits 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 endmenu
menu "USART3 Configuration" menu "USART3 Configuration"
@ -1565,6 +1579,13 @@ config USART3_2STOP
---help--- ---help---
Two stop bits 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 endmenu
menu "UART4 Configuration" menu "UART4 Configuration"
@ -1614,6 +1635,13 @@ config USART4_2STOP
---help--- ---help---
Two stop bits 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 endmenu
menu "UART5 Configuration" menu "UART5 Configuration"
@ -1663,6 +1691,13 @@ config USART5_2STOP
---help--- ---help---
Two stop bits 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 endmenu
menu "USART6 Configuration" menu "USART6 Configuration"
@ -1712,6 +1747,13 @@ config USART6_2STOP
---help--- ---help---
Two stop bits 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 endmenu
menu "SPI Configuration" menu "SPI Configuration"

3
nuttx/configs/README.txt

@ -1495,9 +1495,6 @@ configs/pic32mx7mmb
This directory will (eventually) contain the port of NuttX to the This directory will (eventually) contain the port of NuttX to the
Mikroelektronika PIC32MX7 Multimedia Board (MMB). See Mikroelektronika PIC32MX7 Multimedia Board (MMB). See
http://www.mikroe.com/ for further information. 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 configs/pjrc-8051
8051 Microcontroller. This port uses the PJRC 87C52 development system 8051 Microcontroller. This port uses the PJRC 87C52 development system

2
nuttx/configs/pic32mx7mmb/README.txt

@ -2,7 +2,7 @@ configs/pic32mx7mmb README
=============================== ===============================
This README file discusses the port of NuttX to the Mikroelektronika PIC32MX7 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 Contents
======== ========

18
nuttx/sched/task_delete.c

@ -83,6 +83,21 @@
* This function causes a specified task to cease to exist. Its stack and * 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(). * 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: * Inputs:
* pid - The task ID of the task to delete. A pid of zero * pid - The task ID of the task to delete. A pid of zero
* signifies the calling task. * 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 * this as early as possible so that higher level clean-up logic
* can run in a healthy tasking environment. * 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??? * I suppose EXIT_SUCCESS is an appropriate return value???
*/ */

18
nuttx/sched/task_exithook.c

@ -114,14 +114,32 @@ void task_exithook(FAR _TCB *tcb, int status)
#ifdef CONFIG_SCHED_ATEXIT #ifdef CONFIG_SCHED_ATEXIT
if (tcb->atexitfunc) if (tcb->atexitfunc)
{ {
/* Call the atexit function */
(*tcb->atexitfunc)(); (*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 #endif
#ifdef CONFIG_SCHED_ONEXIT #ifdef CONFIG_SCHED_ONEXIT
if (tcb->onexitfunc) if (tcb->onexitfunc)
{ {
/* Call the on_exit function */
(*tcb->onexitfunc)(status, tcb->onexitarg); (*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 #endif

Loading…
Cancel
Save