diff options
Diffstat (limited to '')
| -rw-r--r-- | web/adapter.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/web/adapter.cpp b/web/adapter.cpp index 3df3a54..9cb2e2d 100644 --- a/web/adapter.cpp +++ b/web/adapter.cpp | |||
| @@ -151,13 +151,14 @@ int poll_status(void *arg) | |||
| 151 | if (arg == nullptr) | 151 | if (arg == nullptr) |
| 152 | return nissy::status::RUN.value; | 152 | return nissy::status::RUN.value; |
| 153 | 153 | ||
| 154 | std::function<int(void)> poll((int (*)(void))arg); | 154 | std::function<int(void)> poll((int (*)(void))*(int *)arg); |
| 155 | return poll(); | 155 | return poll(); |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | // The parameter js_poll_status is of type int here, but actually it is a | 158 | // The parameter js_poll_status is of type int here, but actually it is a |
| 159 | // pointer to a JS function. The type will have to be changed to a 64-bit | 159 | // pointer to a JS function. The type will have to be changed to a 64-bit |
| 160 | // integer when we move to WASM64. | 160 | // integer when we move to WASM64. |
| 161 | int js_poll_status_global = 0; | ||
| 161 | nissy::solver::solve_result solve(std::string name, | 162 | nissy::solver::solve_result solve(std::string name, |
| 162 | nissy::cube cube, nissy::nissflag nissflag, unsigned minmoves, | 163 | nissy::cube cube, nissy::nissflag nissflag, unsigned minmoves, |
| 163 | unsigned maxmoves, unsigned maxsols, unsigned optimal, unsigned threads, | 164 | unsigned maxmoves, unsigned maxsols, unsigned optimal, unsigned threads, |
| @@ -179,9 +180,10 @@ nissy::solver::solve_result solve(std::string name, | |||
| 179 | 180 | ||
| 180 | // TODO: when running multiple solvers at the same time, we could use | 181 | // TODO: when running multiple solvers at the same time, we could use |
| 181 | // poll_status_id as intended (i.e. an id of some sort) | 182 | // poll_status_id as intended (i.e. an id of some sort) |
| 183 | js_poll_status_global = js_poll_status; | ||
| 182 | return loaded_solvers.at(name).solve(cube, nissflag, minmoves, | 184 | return loaded_solvers.at(name).solve(cube, nissflag, minmoves, |
| 183 | maxmoves, maxsols, optimal, threads, | 185 | maxmoves, maxsols, optimal, threads, |
| 184 | poll_status, &js_poll_status); | 186 | poll_status, &js_poll_status_global); |
| 185 | } | 187 | } |
| 186 | 188 | ||
| 187 | EMSCRIPTEN_BINDINGS(Nissy) | 189 | EMSCRIPTEN_BINDINGS(Nissy) |
