Startup wasm worker all at once

This commit is contained in:
msqr1
2024-09-27 17:34:30 -07:00
parent 4f78f596ae
commit e3f19bc6cf
9 changed files with 25 additions and 28 deletions

View File

@@ -1,11 +1,11 @@
#pragma once
#include <filesystem>
#include <functional>
#include <variant>
#include <fstream>
#include <functional>
#include <emscripten/atomic.h>
#include <emscripten/console.h>
#include "emscripten/atomic.h"
#include "emscripten/console.h"
namespace fs = std::filesystem;
@@ -30,12 +30,6 @@ enum UntarStatus {
FailedWrite,
FailedClose
};
struct WorkerPool;
struct Worker {
int handle;
std::function<void()> fn;
static void startup(int _fn, int _pool);
};
#ifndef MAX_WORKERS
#define MAX_WORKERS 1
#endif
@@ -43,7 +37,6 @@ struct WorkerPool {
bool qLock{true}; // True is locked, false is unlocked
bool done{};
std::queue<std::function<void()>> taskQ;
std::array<Worker, MAX_WORKERS> workers;
WorkerPool();
~WorkerPool();
void exec(std::function<void()> fn);