Simplify the enough work algorithm dramatically.
diff --git a/cgminer.c b/cgminer.c
index e6a694b..548de74 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -2408,9 +2408,13 @@ static void *get_work_thread(void *userdata)
ts = __total_staged();
mutex_unlock(stgd_lock);
- if (((cs >= opt_queue || cq >= opt_queue) && ts >= maxq) ||
- ((cs >= opt_queue || cq >= opt_queue) && tq >= maxq && ((cq < maxq && !opt_fail_only) || opt_fail_only)) ||
- clone_available())
+ if (ts >= maxq)
+ goto out;
+
+ if (ts >= opt_queue && tq >= maxq)
+ goto out;
+
+ if (clone_available())
goto out;
ret_work = make_work();