Refactor devices_status to have better thread control

This commit is contained in:
jsteube
2016-09-19 15:52:01 +02:00
parent cecf7473a6
commit 9daf139fef
14 changed files with 229 additions and 271 deletions
+44 -7
View File
@@ -140,14 +140,58 @@ void hc_signal (void (callback) (int))
#endif
void mycracked (opencl_ctx_t *opencl_ctx)
{
if (opencl_ctx->devices_status != STATUS_RUNNING) return;
opencl_ctx->devices_status = STATUS_CRACKED;
opencl_ctx->run_main_level1 = false;
opencl_ctx->run_main_level2 = false;
opencl_ctx->run_main_level3 = false;
opencl_ctx->run_thread_level1 = false;
opencl_ctx->run_thread_level2 = false;
}
void myabort (opencl_ctx_t *opencl_ctx)
{
if (opencl_ctx->devices_status != STATUS_RUNNING) return;
opencl_ctx->devices_status = STATUS_ABORTED;
opencl_ctx->run_main_level1 = false;
opencl_ctx->run_main_level2 = false;
opencl_ctx->run_main_level3 = false;
opencl_ctx->run_thread_level1 = false;
opencl_ctx->run_thread_level2 = false;
}
void myquit (opencl_ctx_t *opencl_ctx)
{
if (opencl_ctx->devices_status != STATUS_RUNNING) return;
opencl_ctx->devices_status = STATUS_QUIT;
opencl_ctx->run_main_level1 = false;
opencl_ctx->run_main_level2 = false;
opencl_ctx->run_main_level3 = false;
opencl_ctx->run_thread_level1 = false;
opencl_ctx->run_thread_level2 = false;
}
void bypass (opencl_ctx_t *opencl_ctx)
{
if (opencl_ctx->devices_status != STATUS_RUNNING) return;
opencl_ctx->devices_status = STATUS_BYPASS;
opencl_ctx->run_main_level1 = true;
opencl_ctx->run_main_level2 = true;
opencl_ctx->run_main_level3 = true;
opencl_ctx->run_thread_level1 = false;
opencl_ctx->run_thread_level2 = false;
log_info ("Next dictionary / mask in queue selected, bypassing current one");
}
void SuspendThreads (opencl_ctx_t *opencl_ctx)
@@ -175,10 +219,3 @@ void ResumeThreads (opencl_ctx_t *opencl_ctx)
log_info ("Resumed");
}
void bypass (opencl_ctx_t *opencl_ctx)
{
opencl_ctx->devices_status = STATUS_BYPASS;
log_info ("Next dictionary / mask in queue selected, bypassing current one");
}