a promising run

This commit is contained in:
msqr1
2024-01-28 22:05:58 -08:00
parent 8796f35445
commit c34d3f8974
20 changed files with 6317 additions and 167 deletions

View File

@@ -1,12 +1,26 @@
#include "global.h"
// Throw error for user, or just throw the message for internal communication
void throwJS(const char* msg, bool err) {
EM_ASM({
if($1) {
throw Error(UTF8ToString($0));
return;
}
throw UTF8ToString($0);
},msg, err);
static pthread_t targetThrd{pthread_self()};
static ProxyingQueue pq{};
if(pthread_self() == targetThrd) {
EM_ASM({
if($1) {
throw Error(UTF8ToString($0));
return;
}
throw UTF8ToString($0);
},msg, err);
}
pq.proxyAsync(targetThrd, [&](){
EM_ASM({
if($1) {
throw Error(UTF8ToString($0));
return;
}
throw UTF8ToString($0);
},msg, err);
});
}
int main() {
//vosk_set_log_level(-1);
@@ -14,4 +28,5 @@ int main() {
wasmfs_create_directory("/opfs",0777,wasmfs_create_opfs_backend());
}};
t.detach();
emscripten_exit_with_live_runtime();
}