fixed(freertos): Fix crash when wasm app call pthread_exit(NULL) (#2970)

before the change, only support wasm app exit like:
```c
void *thread_routine(void *arg)
{
    printf("Enter thread\n");
    return NULL;
}
```
if call pthread_exit, it will crash:
```c
void *thread_routine(void *arg)
{
    printf("Enter thread\n");
    pthread_exit(NULL);
    return NULL;
}
```
This commit lets both upstairs work correctly, test pass on stm32f103 mcu.
This commit is contained in:
tkernelcn 2024-01-02 17:32:09 +08:00 committed by GitHub
parent ef5e74fd8a
commit 286ea35508
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -205,7 +205,6 @@ os_thread_wrapper(void *arg)
thread_data->start_routine(thread_data->arg);
os_thread_cleanup();
vTaskDelete(NULL);
}
int
@ -301,6 +300,22 @@ os_thread_join(korp_tid thread, void **value_ptr)
return BHT_OK;
}
int
os_thread_detach(korp_tid thread)
{
/* Do nothing */
(void)thread;
return BHT_OK;
}
void
os_thread_exit(void *retval)
{
(void)retval;
os_thread_cleanup();
vTaskDelete(NULL);
}
int
os_mutex_init(korp_mutex *mutex)
{
@ -469,3 +484,16 @@ os_cond_broadcast(korp_cond *cond)
return BHT_OK;
}
uint8 *
os_thread_get_stack_boundary()
{
/* TODO: get freertos stack boundary */
return NULL;
}
void
os_thread_jit_write_protect_np(bool enabled)
{
(void)enabled;
}