From 171bfbbb8bda1bbb1339c80481f24ae97b518876 Mon Sep 17 00:00:00 2001 From: jsteube Date: Wed, 28 Sep 2016 13:15:23 +0200 Subject: [PATCH] Get rid of shutdown_inner and shutdown_outer --- include/types.h | 7 ------- src/hashcat.c | 8 -------- src/monitor.c | 2 +- src/outfile_check.c | 8 ++++---- src/status.c | 4 ++-- src/terminal.c | 2 +- 6 files changed, 8 insertions(+), 23 deletions(-) diff --git a/include/types.h b/include/types.h index d63bbe962..538d885f7 100644 --- a/include/types.h +++ b/include/types.h @@ -1216,13 +1216,6 @@ typedef struct user_options_extra_t *user_options_extra; user_options_t *user_options; - /** - * threads - */ - - u32 shutdown_inner; - u32 shutdown_outer; - /** * hardware watchdog */ diff --git a/src/hashcat.c b/src/hashcat.c index 88f0aff88..8112b784e 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -1772,8 +1772,6 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_ hc_thread_t *inner_threads = (hc_thread_t *) mycalloc (10, sizeof (hc_thread_t)); - data.shutdown_inner = 0; - /** * Outfile remove */ @@ -1894,8 +1892,6 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_ // wait for inner threads - data.shutdown_inner = 1; - for (uint thread_idx = 0; thread_idx < inner_threads_cnt; thread_idx++) { hc_thread_wait (1, &inner_threads[thread_idx]); @@ -2713,8 +2709,6 @@ int main (int argc, char **argv) hc_thread_t *outer_threads = (hc_thread_t *) mycalloc (10, sizeof (hc_thread_t)); - data.shutdown_outer = 0; - if (user_options->keyspace == false && user_options->benchmark == false && user_options->stdout_flag == false) { if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK)) @@ -2762,8 +2756,6 @@ int main (int argc, char **argv) // wait for outer threads - data.shutdown_outer = 1; - for (uint thread_idx = 0; thread_idx < outer_threads_cnt; thread_idx++) { hc_thread_wait (1, &outer_threads[thread_idx]); diff --git a/src/monitor.c b/src/monitor.c index 1da0e0d72..d422d17b3 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -109,7 +109,7 @@ void *thread_monitor (void *p) u32 remove_left = user_options->remove_timer; u32 status_left = user_options->status_timer; - while (data.shutdown_inner == 0) + while (opencl_ctx->run_main_level2 == true) { hc_sleep (sleep_time); diff --git a/src/outfile_check.c b/src/outfile_check.c index 02c220052..3baee7e71 100644 --- a/src/outfile_check.c +++ b/src/outfile_check.c @@ -70,11 +70,11 @@ void *thread_outfile_remove (void *p) time_t folder_mtime = 0; - int out_cnt = 0; + int out_cnt = 0; uint check_left = outfile_check_timer; // or 1 if we want to check it at startup - while (data.shutdown_inner == 0) + while (opencl_ctx->run_main_level2 == true) { hc_sleep (1); @@ -319,9 +319,9 @@ void *thread_outfile_remove (void *p) } } - if (esalt_size) myfree (hash_buf.esalt); + myfree (hash_buf.esalt); - if (is_salted) myfree (hash_buf.salt); + myfree (hash_buf.salt); myfree (hash_buf.digest); diff --git a/src/status.c b/src/status.c index 24889c79a..47307db96 100644 --- a/src/status.c +++ b/src/status.c @@ -323,7 +323,7 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c } // in this case some required buffers are free'd, ascii_digest() would run into segfault - if (data.shutdown_inner == 1) return; + if (opencl_ctx->run_main_level2 == false) return; if (user_options->machine_readable == true) { @@ -1158,7 +1158,7 @@ void status_benchmark (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, return; } - if (data.shutdown_inner == 1) return; + if (opencl_ctx->run_main_level2 == false) return; if (user_options->machine_readable == true) { diff --git a/src/terminal.c b/src/terminal.c index 6241e814d..d38091d1e 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -76,7 +76,7 @@ void *thread_keypress (void *p) tty_break (); - while (data.shutdown_outer == 0) + while (opencl_ctx->run_main_level1 == true) { int ch = tty_getchar ();