1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-16 19:58:25 +00:00

Remove some unneeded mutex

This commit is contained in:
jsteube 2016-09-30 00:04:12 +02:00
parent 133c9295f5
commit c53de67cd4
7 changed files with 20 additions and 32 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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;
}

View File

@ -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++;

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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 ();