fix crack5opencl queue/threads.c

This commit is contained in:
Gabriele Gristina 2021-09-19 02:34:47 +02:00
commit 0263b15885
2 changed files with 5 additions and 8 deletions

View file

@ -371,8 +371,6 @@ int wu_queue_destroy(wu_queue_ctx_t *ctx) {
if (!ctx) return ERROR_CTX_NULL; if (!ctx) return ERROR_CTX_NULL;
if (!ctx->init) return ERROR_CTX_IS_NOT_INIT; if (!ctx->init) return ERROR_CTX_IS_NOT_INIT;
pthread_mutex_lock(&ctx->queue_mutex);
int ret = -1; int ret = -1;
// unload the queue // unload the queue
@ -398,8 +396,6 @@ int wu_queue_destroy(wu_queue_ctx_t *ctx) {
ctx->queue_tail = 0; //NULL; ctx->queue_tail = 0; //NULL;
ctx->init = 0; ctx->init = 0;
pthread_mutex_unlock(&ctx->queue_mutex);
pthread_mutex_destroy(&ctx->queue_mutex); pthread_mutex_destroy(&ctx->queue_mutex);
pthread_mutexattr_destroy(&ctx->queue_mutex_attr); pthread_mutexattr_destroy(&ctx->queue_mutex_attr);

View file

@ -504,15 +504,15 @@ void *computing_process(void *arg) {
off = wu.off; off = wu.off;
a->slice = wu.id + 1; a->slice = wu.id + 1;
float progress = (((wu.id + 1) * 100.0) / wu.max);
if (ctx->queue_ctx.queue_type == QUEUE_TYPE_RANDOM) { if (ctx->queue_ctx.queue_type == QUEUE_TYPE_RANDOM) {
float progress = 100.0 - (((wu.rem + 1) * 100.0) / wu.max);
#if DEBUGME > 0 #if DEBUGME > 0
printf("[%zu] Slice %zu (off %zu), max %zu, remain %zu slice(s)\n", z, wu.id + 1, wu.off, wu.max, wu.rem); printf("[%zu] Slice %zu (off %zu), max %zu, remain %zu slice(s)\n", z, wu.id + 1, wu.off, wu.max, wu.rem);
#else #else
printf("\r[%zu] Slice %zu/%zu (%zu remain) ( %2.1f%% )", z, wu.id + 1, wu.max, wu.rem, progress); printf("\r[%zu] Slice %zu/%zu (%zu remain) ( %2.1f%% )", z, wu.id + 1, wu.max, wu.rem, progress);
#endif // DEBUGME #endif // DEBUGME
} else { } else {
float progress = (((wu.id + 1) * 100.0) / wu.max);
#if DEBUGME > 0 #if DEBUGME > 0
printf("[%zu] Slice %zu/%zu, off %zu\n", z, wu.id + 1, wu.max, wu.off); printf("[%zu] Slice %zu/%zu, off %zu\n", z, wu.id + 1, wu.max, wu.off);
#else #else
@ -659,14 +659,15 @@ void *computing_process_async(void *arg) {
uint32_t off = wu.off; uint32_t off = wu.off;
a->slice = wu.id + 1; a->slice = wu.id + 1;
float progress = (((wu.id + 1) * 100.0) / wu.max);
if (ctx->queue_ctx.queue_type == QUEUE_TYPE_RANDOM) { if (ctx->queue_ctx.queue_type == QUEUE_TYPE_RANDOM) {
float progress = 100.0 - (((wu.rem + 1) * 100.0) / wu.max);
#if DEBUGME > 0 #if DEBUGME > 0
printf("[%zu] Slice %zu (off %zu), max %zu, remain %zu slice(s)\n", z, wu.id + 1, wu.off, wu.max, wu.rem); printf("[%zu] Slice %zu (off %zu), max %zu, remain %zu slice(s)\n", z, wu.id + 1, wu.off, wu.max, wu.rem);
#else #else
printf("[%zu] Slice %zu/%zu (%zu remain) ( %2.1f%% )", z, wu.id + 1, wu.max, wu.rem, progress); printf("\r[%zu] Slice %zu/%zu (%zu remain) ( %2.1f%% )", z, wu.id + 1, wu.max, wu.rem, progress);
#endif // DEBUGME #endif // DEBUGME
} else { } else {
float progress = (((wu.id + 1) * 100.0) / wu.max);
#if DEBUGME > 0 #if DEBUGME > 0
printf("[%zu] Slice %zu/%zu, off %zu\n", z, wu.id + 1, wu.max, wu.off); printf("[%zu] Slice %zu/%zu, off %zu\n", z, wu.id + 1, wu.max, wu.off);
#else #else