mirror of
https://github.com/hashcat/hashcat.git
synced 2025-02-18 10:32:04 +00:00
Fix race-condition in thread_keypress()
This commit is contained in:
parent
57195b475a
commit
4cde17aea7
@ -18,6 +18,7 @@ u64 mydivc64 (const u64 dividend, const u64 divisor);
|
||||
void naive_replace (char *s, const u8 key_char, const u8 replace_char);
|
||||
void naive_escape (char *s, size_t s_max, const u8 key_char, const u8 escape_char);
|
||||
|
||||
void hc_sleep_ms (const int msec);
|
||||
void hc_sleep (const int sec);
|
||||
|
||||
#endif // _SHARED_H
|
||||
|
15
src/shared.c
15
src/shared.c
@ -74,11 +74,20 @@ void naive_escape (char *s, size_t s_max, const u8 key_char, const u8 escape_cha
|
||||
strncpy (s, s_escaped, s_max - 1);
|
||||
}
|
||||
|
||||
void hc_sleep_ms (const int msec)
|
||||
{
|
||||
#if defined (_WIN)
|
||||
Sleep (msec);
|
||||
#else
|
||||
usleep (msec * 1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
void hc_sleep (const int sec)
|
||||
{
|
||||
#if defined (_WIN)
|
||||
#define sleep(x) Sleep ((x) * 1000)
|
||||
#endif
|
||||
|
||||
Sleep (sec * 1000);
|
||||
#else
|
||||
sleep (sec);
|
||||
#endif
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "loopback.h"
|
||||
#include "data.h"
|
||||
#include "status.h"
|
||||
#include "shared.h"
|
||||
#include "terminal.h"
|
||||
|
||||
extern hc_global_data_t data;
|
||||
@ -59,6 +60,9 @@ void clear_prompt ()
|
||||
void *thread_keypress (void *p)
|
||||
{
|
||||
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
|
||||
|
||||
while (opencl_ctx->devices_status == STATUS_INIT) hc_sleep_ms (100);
|
||||
|
||||
hashconfig_t *hashconfig = data.hashconfig;
|
||||
hashes_t *hashes = data.hashes;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user