Skip to content

Commit

Permalink
Try restricting signal check to thread 0
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlees committed Dec 19, 2023
1 parent d7f50a8 commit 20a5361
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ NumpyMatrix query_db(std::vector<Reference> &ref_sketches,
{
progress += MAX(1, n_progress_ticks / dist_rows);
dist_progress.tick_count(progress);
if (PyErr_CheckSignals() != 0) {
if (omp_get_thread_num() == 0 && PyErr_CheckSignals() != 0) {
interrupt = true;
}
}
Expand Down Expand Up @@ -270,7 +270,7 @@ NumpyMatrix query_db(std::vector<Reference> &ref_sketches,
{
progress += MAX(1, n_progress_ticks / dist_rows);
dist_progress.tick_count(progress);
if (PyErr_CheckSignals() != 0) {
if (omp_get_thread_num() == 0 && PyErr_CheckSignals() != 0) {
interrupt = true;
}
}
Expand Down Expand Up @@ -371,7 +371,7 @@ sparse_coo query_db_sparse(std::vector<Reference> &ref_sketches,
{
progress += MAX(1, n_progress_ticks / dist_rows);
dist_progress.tick_count(progress);
if (PyErr_CheckSignals() != 0) {
if (omp_get_thread_num() == 0 && PyErr_CheckSignals() != 0) {
interrupt = true;
}
}
Expand Down

0 comments on commit 20a5361

Please sign in to comment.