-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Description
I've been creating patches for 3rd-party library to convert thread creation to a normal function call and remove thread join: mozc libchewing fcitx5-chinese-addons
I know the existence of real pthread support but that needs COEP and COOP. I know these 2 headers can be set by service worker, but I'm creating a JS library that can hopefully be embedded to any website, including those already have their own service worker, so single thread build is the only option for me.
It's possible to not abort on pthread_create and pthread_join, but instead, do a normal function call for create, and return 0 for join.
I've tested with code below
#include <thread>
#include <iostream>
void hello() {
std::cout << "Hello from thread!" << std::endl;
}
int main() {
std::thread t(hello);
t.join();
return 0;
}em++ hello.cpp # The a.out.js can print normally without -pthreadThis is for sure a behavior change, but I hope in a good way. Any concerns?
Metadata
Metadata
Assignees
Labels
No labels