summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/main.c b/main.c
index 1589c6a..5b2f73d 100644
--- a/main.c
+++ b/main.c
@@ -60,8 +60,10 @@ bool yield_possible_key(
uint64_t plaintext;
char key[8];
symmetric_key skey;
+ /* check `stop_signal` after every 256 round of loop */
+ uint8_t check_stop = 0;
do {
- if ((b != 0 && k >= b) || atomic_load(stop_signal)) {
+ if ((b != 0 && k >= b) || (!check_stop++ && atomic_load(stop_signal))) {
// out of range, stop
ctx->finished = true;
return false;