libc: abort should always call exit not pthread_exit

since pthread_exit just exit the calling thread not the whole process

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-01-20 23:41:01 +08:00 committed by Petro Karashchenko
parent bcd1ebf260
commit 5333c30d45

View File

@ -63,21 +63,8 @@ void abort(void)
* a conformant version of abort() at this time. This version does not
* signal the calling thread all.
*
* Note that pthread_exit() is called instead of exit(). That is because
* we do no know if abort was called from a pthread or a normal thread
* (we could find out, of course). If abort() is called from a
* non-pthread, then pthread_exit() should fail and fall back to call
* exit() anyway.
*
* If exit() is called (either below or via pthread_exit()), then exit()
* will flush and close all open files and terminate the thread. If this
* function was called from a pthread, then pthread_exit() will complete
* any joins, but will not flush or close any streams.
* exit() will flush and close all open files and terminate the thread.
*/
#ifdef CONFIG_DISABLE_PTHREAD
exit(EXIT_FAILURE);
#else
pthread_exit(NULL);
#endif
}