diff --git a/src/hash_management.c b/src/hash_management.c index 8e6a8c448..9cb1cc8eb 100644 --- a/src/hash_management.c +++ b/src/hash_management.c @@ -38,8 +38,6 @@ extern hc_global_data_t data; -extern hc_thread_mutex_t mux_display; - int sort_by_digest_p0p1 (const void *v1, const void *v2) { const u32 *d1 = (const u32 *) v1; @@ -544,7 +542,7 @@ int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, co uint cpt_cracked = 0; - hc_thread_mutex_lock (mux_display); + hc_thread_mutex_lock (status_ctx->mux_display); for (uint i = 0; i < num_cracked; i++) { @@ -575,13 +573,13 @@ int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, co check_hash (opencl_ctx, device_param, user_options, user_options_extra, straight_ctx, combinator_ctx, &cracked[i]); } - hc_thread_mutex_unlock (mux_display); + hc_thread_mutex_unlock (status_ctx->mux_display); myfree (cracked); if (cpt_cracked > 0) { - hc_thread_mutex_lock (mux_display); + hc_thread_mutex_lock (status_ctx->mux_display); cpt_ctx->cpt_buf[cpt_ctx->cpt_pos].timestamp = time (NULL); cpt_ctx->cpt_buf[cpt_ctx->cpt_pos].cracked = cpt_cracked; @@ -592,7 +590,7 @@ int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, co if (cpt_ctx->cpt_pos == CPT_BUF) cpt_ctx->cpt_pos = 0; - hc_thread_mutex_unlock (mux_display); + hc_thread_mutex_unlock (status_ctx->mux_display); } if (hashconfig->opts_type & OPTS_TYPE_PT_NEVERCRACK) diff --git a/src/hwmon.c b/src/hwmon.c index 24326265f..416c116bb 100644 --- a/src/hwmon.c +++ b/src/hwmon.c @@ -9,8 +9,6 @@ #include "logging.h" #include "hwmon.h" -hc_thread_mutex_t mux_hwmon; - static int get_adapters_num_adl (void *adl, int *iNumberAdapters) { if (hm_ADL_Adapter_NumberOfAdapters_Get ((ADL_PTR *) adl, iNumberAdapters) != ADL_OK) return -1; diff --git a/src/monitor.c b/src/monitor.c index 36626efd4..a376d6a46 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -34,9 +34,6 @@ extern hc_global_data_t data; -extern hc_thread_mutex_t mux_display; -extern hc_thread_mutex_t mux_hwmon; - void *thread_monitor (void *p) { restore_ctx_t *restore_ctx = data.restore_ctx; @@ -120,7 +117,7 @@ void *thread_monitor (void *p) if (hwmon_check == true) { - hc_thread_mutex_lock (mux_hwmon); + hc_thread_mutex_lock (status_ctx->mux_hwmon); for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) { @@ -173,12 +170,12 @@ void *thread_monitor (void *p) } } - hc_thread_mutex_unlock (mux_hwmon); + hc_thread_mutex_unlock (status_ctx->mux_hwmon); } if (hwmon_check == true) { - hc_thread_mutex_lock (mux_hwmon); + hc_thread_mutex_lock (status_ctx->mux_hwmon); time_t temp_check_time; @@ -276,7 +273,7 @@ void *thread_monitor (void *p) } } - hc_thread_mutex_unlock (mux_hwmon); + hc_thread_mutex_unlock (status_ctx->mux_hwmon); } if (restore_check == true) @@ -344,7 +341,7 @@ void *thread_monitor (void *p) if (status_left == 0) { - hc_thread_mutex_lock (mux_display); + hc_thread_mutex_lock (status_ctx->mux_display); if (user_options->quiet == false) clear_prompt (); @@ -354,7 +351,7 @@ void *thread_monitor (void *p) if (user_options->quiet == false) log_info (""); - hc_thread_mutex_unlock (mux_display); + hc_thread_mutex_unlock (status_ctx->mux_display); status_left = user_options->status_timer; } diff --git a/src/opencl.c b/src/opencl.c index 42262c8e2..a0d45681c 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -1317,13 +1317,13 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash // current speed - //hc_thread_mutex_lock (mux_display); + //hc_thread_mutex_lock (status_ctx->mux_display); device_param->speed_cnt[speed_pos] = perf_sum_all; device_param->speed_ms[speed_pos] = speed_ms; - //hc_thread_mutex_unlock (mux_display); + //hc_thread_mutex_unlock (status_ctx->mux_display); speed_pos++; diff --git a/src/outfile_check.c b/src/outfile_check.c index 4ca6ad6b3..66c7c7b12 100644 --- a/src/outfile_check.c +++ b/src/outfile_check.c @@ -145,7 +145,7 @@ void *thread_outfile_remove (void *p) if (fp != NULL) { - //hc_thread_mutex_lock (mux_display); + //hc_thread_mutex_lock (status_ctx->mux_display); #if defined (_POSIX) struct stat outfile_stat; @@ -307,7 +307,7 @@ void *thread_outfile_remove (void *p) out_info[j].seek = ftell (fp); - //hc_thread_mutex_unlock (mux_display); + //hc_thread_mutex_unlock (status_ctx->mux_display); fclose (fp); } diff --git a/src/status.c b/src/status.c index 264a6aaa8..be33cb806 100644 --- a/src/status.c +++ b/src/status.c @@ -31,9 +31,6 @@ #include "status.h" extern hc_global_data_t data; -extern hc_thread_mutex_t mux_hwmon; - -hc_thread_mutex_t mux_display; static const char ST_0000[] = "Initializing"; static const char ST_0001[] = "Autotuning"; @@ -289,7 +286,7 @@ void status_display_machine_readable (status_ctx_t *status_ctx, opencl_ctx_t *op { fprintf (out, "TEMP\t"); - hc_thread_mutex_lock (mux_hwmon); + hc_thread_mutex_lock (status_ctx->mux_hwmon); for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) { @@ -302,7 +299,7 @@ void status_display_machine_readable (status_ctx_t *status_ctx, opencl_ctx_t *op fprintf (out, "%d\t", temp); } - hc_thread_mutex_unlock (mux_hwmon); + hc_thread_mutex_unlock (status_ctx->mux_hwmon); } /** @@ -1018,7 +1015,7 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h if (user_options->gpu_temp_disable == false) { - hc_thread_mutex_lock (mux_hwmon); + hc_thread_mutex_lock (status_ctx->mux_hwmon); for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) { @@ -1097,7 +1094,7 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h log_info ("HWMon.Dev.#%d...:%s", device_id + 1, output_buf); } - hc_thread_mutex_unlock (mux_hwmon); + hc_thread_mutex_unlock (status_ctx->mux_hwmon); } } diff --git a/src/terminal.c b/src/terminal.c index 94a5c3f1e..7cd2527aa 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -32,8 +32,6 @@ extern hc_global_data_t data; -extern hc_thread_mutex_t mux_display; - extern const char *version_tag; const char *PROMPT = "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => "; @@ -168,7 +166,7 @@ void *thread_keypress (void *p) //if (ch != '\n') //#endif - hc_thread_mutex_lock (mux_display); + hc_thread_mutex_lock (status_ctx->mux_display); log_info (""); @@ -250,7 +248,7 @@ void *thread_keypress (void *p) //if (ch != '\n') //#endif - hc_thread_mutex_unlock (mux_display); + hc_thread_mutex_unlock (status_ctx->mux_display); } tty_fix ();