mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2024-11-26 23:42:05 +00:00
esp32: Support app management and thread (#1350)
Support app management and thread on esp-idf platform: - Fix compile issues when app management is enabled - Add missing thread related APIs
This commit is contained in:
parent
bf28030993
commit
b75ae3363d
|
@ -44,6 +44,25 @@ os_mutex_init(korp_mutex *mutex)
|
|||
return pthread_mutex_init(mutex, NULL);
|
||||
}
|
||||
|
||||
int
|
||||
os_recursive_mutex_init(korp_mutex *mutex)
|
||||
{
|
||||
int ret;
|
||||
|
||||
pthread_mutexattr_t mattr;
|
||||
|
||||
assert(mutex);
|
||||
ret = pthread_mutexattr_init(&mattr);
|
||||
if (ret)
|
||||
return BHT_ERROR;
|
||||
|
||||
pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
|
||||
ret = pthread_mutex_init(mutex, &mattr);
|
||||
pthread_mutexattr_destroy(&mattr);
|
||||
|
||||
return ret == 0 ? BHT_OK : BHT_ERROR;
|
||||
}
|
||||
|
||||
int
|
||||
os_mutex_destroy(korp_mutex *mutex)
|
||||
{
|
||||
|
@ -206,3 +225,9 @@ os_cond_signal(korp_cond *cond)
|
|||
{
|
||||
return pthread_cond_signal(cond);
|
||||
}
|
||||
|
||||
int
|
||||
os_cond_broadcast(korp_cond *cond)
|
||||
{
|
||||
return pthread_cond_broadcast(cond);
|
||||
}
|
|
@ -17,6 +17,7 @@
|
|||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "esp_pthread.h"
|
||||
#include "esp_timer.h"
|
||||
|
|
Loading…
Reference in New Issue
Block a user