why must POSIX_Init() call exit() rather than use a "return" statement?

Sebastian Huber sebastian.huber at embedded-brains.de
Wed May 8 05:04:13 UTC 2019


On 07/05/2019 16:53, Morgan, Keith S wrote:
> On Monday, May 6, 2019 11:10 PM Sebastian Huber<sebastian.huber at embedded-brains.de>  wrote:
>
>> Calling exit() and returning from a POSIX thread are two totally different things.
>> If you call exit(), then you terminate the system. If you return from a POSIX
>> thread, then this thread exits. The scheduler just picks up the next highest
>> priority ready thread. This could be the idle thread.
> Ok. This makes sense. I was missing the detail about the idle thread.
>
> However, it seems that the behavior is different between the classic API and the POSIX API. It seems that, in the classic API, terminating a task with a return statement also terminates the system.

Yes, a function return from a Classic API task results in a fatal error. 
You must use rtems_task_delete() or rtems_task_exit() to terminate a 
Classic API task.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the users mailing list