1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-01-22 13:40:56 +00:00

Move global mux_counter variable into opencl_ctx_t

This commit is contained in:
jsteube 2016-09-20 13:26:19 +02:00
parent 3adbf3d0d5
commit ced3b3b82f
5 changed files with 11 additions and 15 deletions

View File

@ -535,6 +535,7 @@ typedef struct
int force_jit_compilation;
hc_thread_mutex_t mux_dispatcher;
hc_thread_mutex_t mux_counter;
} opencl_ctx_t;

View File

@ -38,8 +38,6 @@
extern hc_global_data_t data;
extern hc_thread_mutex_t mux_counter;
static void set_kernel_power_final (const u64 kernel_power_final)
{
if (data.quiet == 0)
@ -179,14 +177,14 @@ void *thread_calc_stdin (void *p)
{
if ((line_len < data.pw_min) || (line_len > data.pw_max))
{
hc_thread_mutex_lock (mux_counter);
hc_thread_mutex_lock (opencl_ctx->mux_counter);
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
data.words_progress_rejected[salt_pos] += data.kernel_rules_cnt;
}
hc_thread_mutex_unlock (mux_counter);
hc_thread_mutex_unlock (opencl_ctx->mux_counter);
continue;
}
@ -414,14 +412,14 @@ void *thread_calc (void *p)
{
max++;
hc_thread_mutex_lock (mux_counter);
hc_thread_mutex_lock (opencl_ctx->mux_counter);
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
data.words_progress_rejected[salt_pos] += data.kernel_rules_cnt;
}
hc_thread_mutex_unlock (mux_counter);
hc_thread_mutex_unlock (opencl_ctx->mux_counter);
continue;
}
@ -435,14 +433,14 @@ void *thread_calc (void *p)
{
max++;
hc_thread_mutex_lock (mux_counter);
hc_thread_mutex_lock (opencl_ctx->mux_counter);
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
data.words_progress_rejected[salt_pos] += data.combs_cnt;
}
hc_thread_mutex_unlock (mux_counter);
hc_thread_mutex_unlock (opencl_ctx->mux_counter);
continue;
}

View File

@ -92,7 +92,6 @@ extern int SUPPRESS_OUTPUT;
extern hc_thread_mutex_t mux_hwmon;
extern hc_thread_mutex_t mux_display;
extern hc_thread_mutex_t mux_counter;
extern void (*get_next_word_func) (char *, u32, u32 *, u32 *);
@ -185,7 +184,6 @@ int main (int argc, char **argv)
int myargc = argc;
char **myargv = argv;
hc_thread_mutex_init (mux_counter);
hc_thread_mutex_init (mux_display);
hc_thread_mutex_init (mux_hwmon);
@ -5332,7 +5330,6 @@ int main (int argc, char **argv)
// destroy others mutex
hc_thread_mutex_delete (mux_counter);
hc_thread_mutex_delete (mux_display);
hc_thread_mutex_delete (mux_hwmon);

View File

@ -40,7 +40,6 @@
extern hc_global_data_t data;
extern hc_thread_mutex_t mux_counter;
extern hc_thread_mutex_t mux_hwmon;
extern const int comptime;
@ -1252,11 +1251,11 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
u64 perf_sum_all = (u64) pws_cnt * (u64) innerloop_left;
hc_thread_mutex_lock (mux_counter);
hc_thread_mutex_lock (opencl_ctx->mux_counter);
data.words_progress_done[salt_pos] += perf_sum_all;
hc_thread_mutex_unlock (mux_counter);
hc_thread_mutex_unlock (opencl_ctx->mux_counter);
/**
* speed
@ -1314,6 +1313,7 @@ int opencl_ctx_init (opencl_ctx_t *opencl_ctx, const char *opencl_platforms, con
}
hc_thread_mutex_init (opencl_ctx->mux_dispatcher);
hc_thread_mutex_init (opencl_ctx->mux_counter);
opencl_ctx->devices_status = STATUS_INIT;
opencl_ctx->run_main_level1 = true;
@ -1500,6 +1500,7 @@ void opencl_ctx_destroy (opencl_ctx_t *opencl_ctx)
myfree (opencl_ctx->platform_devices);
hc_thread_mutex_delete (opencl_ctx->mux_counter);
hc_thread_mutex_delete (opencl_ctx->mux_dispatcher);
myfree (opencl_ctx);

View File

@ -34,7 +34,6 @@ extern hc_global_data_t data;
extern hc_thread_mutex_t mux_hwmon;
hc_thread_mutex_t mux_display;
hc_thread_mutex_t mux_counter;
static void format_timer_display (struct tm *tm, char *buf, size_t len)
{