switch to makefile instead, reuse threads
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user