support pthread_key related APIs (#288)

This commit is contained in:
Xu Jun
2020-06-18 11:37:31 +08:00
committed by GitHub
parent acb68c64c2
commit e3c04e6684
4 changed files with 304 additions and 3 deletions

View File

@ -6,10 +6,11 @@
#ifndef _WAMR_LIB_PTHREAD_H
#define _WAMR_LIB_PTHREAD_H
/* Data type define of pthread, mutex and cond */
/* Data type define of pthread, mutex, cond and key */
typedef unsigned int pthread_t;
typedef unsigned int pthread_mutex_t;
typedef unsigned int pthread_cond_t;
typedef unsigned int pthread_key_t;
/* Thread APIs */
int pthread_create(pthread_t *thread, const void *attr,
@ -46,4 +47,13 @@ int pthread_cond_signal(pthread_cond_t *cond);
int pthread_cond_destroy(pthread_cond_t *cond);
/* Pthread key APIs */
int pthread_key_create(pthread_key_t *key, void (*destructor)(void *));
int pthread_setspecific(pthread_key_t key, const void *value);
void *pthread_getspecific(pthread_key_t key);
int pthread_key_delete(pthread_key_t key);
#endif /* end of _WAMR_LIB_PTHREAD_H */