Skip to content

Commit c718ee1

Browse files
authored
Enable a few more pthread* files (pthread_key*, pthread_once) (#348)
* threads: enable TSD functions * threads: Enable pthread_once
1 parent 697d5f8 commit c718ee1

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@ LIBC_TOP_HALF_MUSL_SOURCES += \
214214
thread/pthread_condattr_setclock.c \
215215
thread/pthread_condattr_setpshared.c \
216216
thread/pthread_create.c \
217+
thread/pthread_getspecific.c \
217218
thread/pthread_join.c \
219+
thread/pthread_key_create.c \
218220
thread/pthread_mutex_consistent.c \
219221
thread/pthread_mutex_destroy.c \
220222
thread/pthread_mutex_init.c \
@@ -229,6 +231,7 @@ LIBC_TOP_HALF_MUSL_SOURCES += \
229231
thread/pthread_mutexattr_setpshared.c \
230232
thread/pthread_mutexattr_setrobust.c \
231233
thread/pthread_mutexattr_settype.c \
234+
thread/pthread_once.c \
232235
thread/pthread_rwlock_destroy.c \
233236
thread/pthread_rwlock_init.c \
234237
thread/pthread_rwlock_rdlock.c \
@@ -242,6 +245,7 @@ LIBC_TOP_HALF_MUSL_SOURCES += \
242245
thread/pthread_rwlockattr_init.c \
243246
thread/pthread_rwlockattr_setpshared.c \
244247
thread/pthread_setcancelstate.c \
248+
thread/pthread_setspecific.c \
245249
thread/pthread_self.c \
246250
thread/pthread_testcancel.c \
247251
thread/sem_destroy.c \

expected/wasm32-wasi/posix/defined-symbols.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,15 @@ __pthread_cond_timedwait
194194
__pthread_create
195195
__pthread_exit
196196
__pthread_join
197+
__pthread_key_create
198+
__pthread_key_delete
197199
__pthread_mutex_lock
198200
__pthread_mutex_timedlock
199201
__pthread_mutex_trylock
200202
__pthread_mutex_trylock_owner
201203
__pthread_mutex_unlock
204+
__pthread_once
205+
__pthread_once_full
202206
__pthread_rwlock_rdlock
203207
__pthread_rwlock_timedrdlock
204208
__pthread_rwlock_timedwrlock
@@ -979,7 +983,10 @@ pthread_condattr_setclock
979983
pthread_condattr_setpshared
980984
pthread_create
981985
pthread_exit
986+
pthread_getspecific
982987
pthread_join
988+
pthread_key_create
989+
pthread_key_delete
983990
pthread_mutex_consistent
984991
pthread_mutex_destroy
985992
pthread_mutex_getprioceiling
@@ -994,6 +1001,7 @@ pthread_mutexattr_setprotocol
9941001
pthread_mutexattr_setpshared
9951002
pthread_mutexattr_setrobust
9961003
pthread_mutexattr_settype
1004+
pthread_once
9971005
pthread_rwlock_destroy
9981006
pthread_rwlock_init
9991007
pthread_rwlock_rdlock
@@ -1008,6 +1016,7 @@ pthread_rwlockattr_init
10081016
pthread_rwlockattr_setpshared
10091017
pthread_self
10101018
pthread_setcancelstate
1019+
pthread_setspecific
10111020
pthread_testcancel
10121021
pthread_timedjoin_np
10131022
pthread_tryjoin_np
@@ -1219,6 +1228,7 @@ truncate
12191228
truncf
12201229
truncl
12211230
tsearch
1231+
tss_get
12221232
twalk
12231233
uname
12241234
ungetc

libc-top-half/musl/src/thread/pthread_key_create.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ int __pthread_key_delete(pthread_key_t k)
5050
sigset_t set;
5151
pthread_t self = __pthread_self(), td=self;
5252

53+
#ifdef __wasilibc_unmodified_upstream
5354
__block_app_sigs(&set);
55+
#endif
5456
__pthread_rwlock_wrlock(&key_lock);
5557

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

6365
__pthread_rwlock_unlock(&key_lock);
66+
#ifdef __wasilibc_unmodified_upstream
6467
__restore_sigs(&set);
68+
#endif
6569

6670
return 0;
6771
}

0 commit comments

Comments
 (0)