2021-02-17 00:02:28 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2006-2018, RT-Thread Development Team
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2021-02-15 Meco Man first version
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
|
2021-02-17 00:27:24 +08:00
|
|
|
#define ABORT_STATUS 1
|
2021-02-17 00:02:28 +08:00
|
|
|
|
2021-02-17 00:18:49 +08:00
|
|
|
void __exit__(int status)
|
2021-02-17 00:02:28 +08:00
|
|
|
{
|
|
|
|
rt_thread_t self = rt_thread_self();
|
|
|
|
|
|
|
|
#ifdef RT_USING_MODULE
|
|
|
|
if (dlmodule_self())
|
|
|
|
{
|
|
|
|
dlmodule_exit(status);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (self != RT_NULL)
|
|
|
|
{
|
|
|
|
if(status == ABORT_STATUS) /* abort() */
|
|
|
|
{
|
2021-02-17 00:27:24 +08:00
|
|
|
rt_kprintf("thread:%s abort!\n", self->name);
|
2021-02-17 00:02:28 +08:00
|
|
|
}
|
|
|
|
else /* exit() */
|
|
|
|
{
|
2021-02-17 00:27:24 +08:00
|
|
|
rt_kprintf("thread:%s exit:%d!\n", self->name, status);
|
2021-02-17 00:02:28 +08:00
|
|
|
}
|
|
|
|
rt_thread_suspend(self);
|
|
|
|
rt_schedule();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-17 00:18:49 +08:00
|
|
|
void __abort__(void)
|
2021-02-17 00:02:28 +08:00
|
|
|
{
|
|
|
|
__exit__(ABORT_STATUS);
|
|
|
|
}
|
|
|
|
|
2021-02-17 00:18:49 +08:00
|
|
|
int __system__(const char *string)
|
2021-02-17 00:02:28 +08:00
|
|
|
{
|
|
|
|
/* TODO */
|
|
|
|
return 0;
|
|
|
|
}
|