Need Help with Pthread example #23507
-
#include <pthread.h>
#include <emscripten.h>
#include <emscripten/console.h>
#define NUM_THREADS 4
void *thread_main(void *arg)
{
emscripten_out("hello from thread!");
emscripten_force_exit(0);
__builtin_trap();
}
int main(){
return 0;
}
extern "C" {
int delta() {
pthread_t thread;
pthread_create(&thread, NULL, thread_main, NULL);
emscripten_exit_with_live_runtime();
__builtin_trap();
return 1;
}
} emcc panda.cpp -o panda.wasm -s WASM=1 -s EXPORTED_FUNCTIONS=_delta -s -pthread
if possible plz provide an good example stuck to understand why it wont work with .wasm |
Beta Was this translation helpful? Give feedback.
Answered by
kripken
Jan 27, 2025
Replies: 1 comment
-
See #23506 (comment) - wasm without JS has no way to spawn threads. JS is necessary. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
xalteropsx
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See #23506 (comment) - wasm without JS has no way to spawn threads. JS is necessary.