Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a stub pthreads library for THREAD_MODEL=single #518

Merged
merged 13 commits into from
Oct 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a stub for pthread_once
ArcaneNibble committed Oct 10, 2024
commit 7ea3949cbf23a33077de718e0191cfaafac78f35
1 change: 1 addition & 0 deletions expected/wasm32-wasip1/defined-symbols.txt
Original file line number Diff line number Diff line change
@@ -1002,6 +1002,7 @@ pthread_mutexattr_setprotocol
pthread_mutexattr_setpshared
pthread_mutexattr_setrobust
pthread_mutexattr_settype
pthread_once
pthread_rwlock_destroy
pthread_rwlock_init
pthread_rwlock_rdlock
1 change: 1 addition & 0 deletions expected/wasm32-wasip2/defined-symbols.txt
Original file line number Diff line number Diff line change
@@ -1135,6 +1135,7 @@ pthread_mutexattr_setprotocol
pthread_mutexattr_setpshared
pthread_mutexattr_setrobust
pthread_mutexattr_settype
pthread_once
pthread_rwlock_destroy
pthread_rwlock_init
pthread_rwlock_rdlock
9 changes: 9 additions & 0 deletions stub-pthreads/stub-pthreads-good.c
Original file line number Diff line number Diff line change
@@ -7,3 +7,12 @@ static void dummy_0()
}
weak_alias(dummy_0, __acquire_ptc);
weak_alias(dummy_0, __release_ptc);

int pthread_once(pthread_once_t *control, void (*init)(void))
{
if (!*control) {
init();
*control = 1;
}
return 0;
}