Skip to content

Commit

Permalink
Enable a few more pthread* files (pthread_key*, pthread_once) (#348)
Browse files Browse the repository at this point in the history
* threads: enable TSD functions

* threads: Enable pthread_once
  • Loading branch information
loganek authored Nov 30, 2022
1 parent 697d5f8 commit c718ee1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ LIBC_TOP_HALF_MUSL_SOURCES += \
thread/pthread_condattr_setclock.c \
thread/pthread_condattr_setpshared.c \
thread/pthread_create.c \
thread/pthread_getspecific.c \
thread/pthread_join.c \
thread/pthread_key_create.c \
thread/pthread_mutex_consistent.c \
thread/pthread_mutex_destroy.c \
thread/pthread_mutex_init.c \
Expand All @@ -229,6 +231,7 @@ LIBC_TOP_HALF_MUSL_SOURCES += \
thread/pthread_mutexattr_setpshared.c \
thread/pthread_mutexattr_setrobust.c \
thread/pthread_mutexattr_settype.c \
thread/pthread_once.c \
thread/pthread_rwlock_destroy.c \
thread/pthread_rwlock_init.c \
thread/pthread_rwlock_rdlock.c \
Expand All @@ -242,6 +245,7 @@ LIBC_TOP_HALF_MUSL_SOURCES += \
thread/pthread_rwlockattr_init.c \
thread/pthread_rwlockattr_setpshared.c \
thread/pthread_setcancelstate.c \
thread/pthread_setspecific.c \
thread/pthread_self.c \
thread/pthread_testcancel.c \
thread/sem_destroy.c \
Expand Down
10 changes: 10 additions & 0 deletions expected/wasm32-wasi/posix/defined-symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,15 @@ __pthread_cond_timedwait
__pthread_create
__pthread_exit
__pthread_join
__pthread_key_create
__pthread_key_delete
__pthread_mutex_lock
__pthread_mutex_timedlock
__pthread_mutex_trylock
__pthread_mutex_trylock_owner
__pthread_mutex_unlock
__pthread_once
__pthread_once_full
__pthread_rwlock_rdlock
__pthread_rwlock_timedrdlock
__pthread_rwlock_timedwrlock
Expand Down Expand Up @@ -979,7 +983,10 @@ pthread_condattr_setclock
pthread_condattr_setpshared
pthread_create
pthread_exit
pthread_getspecific
pthread_join
pthread_key_create
pthread_key_delete
pthread_mutex_consistent
pthread_mutex_destroy
pthread_mutex_getprioceiling
Expand All @@ -994,6 +1001,7 @@ pthread_mutexattr_setprotocol
pthread_mutexattr_setpshared
pthread_mutexattr_setrobust
pthread_mutexattr_settype
pthread_once
pthread_rwlock_destroy
pthread_rwlock_init
pthread_rwlock_rdlock
Expand All @@ -1008,6 +1016,7 @@ pthread_rwlockattr_init
pthread_rwlockattr_setpshared
pthread_self
pthread_setcancelstate
pthread_setspecific
pthread_testcancel
pthread_timedjoin_np
pthread_tryjoin_np
Expand Down Expand Up @@ -1219,6 +1228,7 @@ truncate
truncf
truncl
tsearch
tss_get
twalk
uname
ungetc
Expand Down
4 changes: 4 additions & 0 deletions libc-top-half/musl/src/thread/pthread_key_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ int __pthread_key_delete(pthread_key_t k)
sigset_t set;
pthread_t self = __pthread_self(), td=self;

#ifdef __wasilibc_unmodified_upstream
__block_app_sigs(&set);
#endif
__pthread_rwlock_wrlock(&key_lock);

__tl_lock();
Expand All @@ -61,7 +63,9 @@ int __pthread_key_delete(pthread_key_t k)
keys[k] = 0;

__pthread_rwlock_unlock(&key_lock);
#ifdef __wasilibc_unmodified_upstream
__restore_sigs(&set);
#endif

return 0;
}
Expand Down

0 comments on commit c718ee1

Please sign in to comment.