switch to makefile instead, reuse threads

This commit is contained in:
msqr1
2024-02-03 22:19:17 -08:00
parent 076e9f65a2
commit 70b7d2c21b
13 changed files with 167 additions and 155 deletions

View File

@@ -1,5 +1,4 @@
#include "global.h"
void throwJS(const char* msg, bool err) {
EM_ASM({
if($1) {
@@ -22,12 +21,24 @@ void fireEv(const char *type, const char *content, int index) {
}
pq.proxySync(selfTID, proxy);
}
int main() {
//vosk_set_log_level(-1);
std::thread t{[](){
wasmfs_create_directory("/opfs", 0777, wasmfs_create_opfs_backend());
}};
t.detach();
emscripten_exit_with_live_runtime();
}
}
void twiceThrd::setTask1(std::function<void()> task1) {
blocker.lock();
std::thread t{[this, task1](){
task1();
blocker.lock();
task2();
}};
t.detach();
}
void twiceThrd::setTask2(std::function<void()> task2) {
this->task2 = task2;
blocker.unlock();
reusable = false;
}