-
Notifications
You must be signed in to change notification settings - Fork 3.4k
embind cannot be initialized correctly in a thread created in static constructor #19849
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
Comments
I'm curious about this statement. Why does running |
From my investigation, EMSCRIPTEN_BINDINGS macro works based on static constructors. when it contructs, the embind declare function are registered to |
A small example the reproduces the issue would be helpful. |
Ah yes, |
|
Uh oh!
There was an error while loading. Please reload this page.
I found this bug because I created a thread in
wasmfs_before_preload()
, which has__attribute__((init_priority(100)))
.When the thread runs, embind has not been fully initialized in main thread. So
Module['__embind_initialize_bindings']
did not register the types for me, but setinitializedJS
to true.I did not use embind in thread created in
wasmfs_before_preload
, but the worker is reused in another thread, and in that thread embind does not work, caused a crash in my app.I hope we can have a way to ensure
wasm_init_ctors
are completed, or embind inited, whenspawnthread
get called.The text was updated successfully, but these errors were encountered: