From c6a77f30f64be73a5e55e06336975f2ecfbb2324 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Fri, 23 May 2025 16:48:58 +0200 Subject: Do all loggin in main thread Before this committ, the solver (via the generic solution-appender routines in src/solve/solutions.h) and the H48 data generator did some logging in the worker threads, without using any locks. This was not nice, but in practice it did not cause any problem, because the log messages were rare. However, this turned out to be a problem when building to WASM, because web workers do not have access to the main JS memory, and therefore they cannot call functions from the main JS. This includes not only the callback functions for logging, but also those for polling the status of the solver (run / pause / stop). This commit fixes this at the cost or being somewhat inelegant: the solutions are not logged as they are found, but only every 500ms. --- src/utils/sleep.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/utils') diff --git a/src/utils/sleep.h b/src/utils/sleep.h index d618e9b..7cdd081 100644 --- a/src/utils/sleep.h +++ b/src/utils/sleep.h @@ -1,3 +1,5 @@ +#define BASE_SLEEP_TIME 500 + STATIC void msleep(int); #if defined(WIN32) -- cgit v1.3