| 368 | } |
| 369 | |
| 370 | std::tuple<unsigned, unsigned, unsigned, std::chrono::steady_clock::duration> |
| 371 | solve(stdexec::parallel_scheduler sch, unsigned short const *init_values) |
| 372 | { |
| 373 | nSols = 0; |
| 374 | nTasks = 0; |
| 375 | nRaces = 0; |
| 376 | std::unique_ptr<board_element[]> start_board{new board_element[BOARD_SIZE]}; |
| 377 | init_board(start_board.get(), init_values); |
| 378 | auto start = std::chrono::steady_clock::now(); |
| 379 | stdexec::inplace_stop_source stop; |
| 380 | auto canceled = []() |
| 381 | { |
| 382 | if (verbose) |
| 383 | { |
| 384 | printf("\ncanceled \n\n"); |
| 385 | } |
| 386 | }; |
| 387 | stdexec::inplace_stop_token::template callback_type<decltype(canceled)> callback(stop.get_token(), |
| 388 | canceled); |
| 389 | stdexec::simple_counting_scope scope; |
| 390 | spawn_partial_solve(sch, scope, stop, std::move(start_board), 0); |
| 391 | stdexec::sync_wait(scope.join()); |
| 392 | return std::make_tuple((unsigned) nSols, |
| 393 | (unsigned) nTasks, |
| 394 | (unsigned) nRaces, |
| 395 | std::chrono::steady_clock::now() - start); |
| 396 | } |
| 397 | |
| 398 | using double_sec = std::chrono::duration<double>; |
| 399 |
no test coverage detected