|
|
@ -3052,14 +3052,19 @@ static void *getwork_thread(void __maybe_unused *userdata) |
|
|
|
RenameThread("getwork_sched"); |
|
|
|
RenameThread("getwork_sched"); |
|
|
|
|
|
|
|
|
|
|
|
while (42) { |
|
|
|
while (42) { |
|
|
|
|
|
|
|
int ts, max_staged = opt_queue; |
|
|
|
struct pool *pool, *cp; |
|
|
|
struct pool *pool, *cp; |
|
|
|
bool lagging = false; |
|
|
|
bool lagging = false; |
|
|
|
struct curl_ent *ce; |
|
|
|
struct curl_ent *ce; |
|
|
|
struct work *work; |
|
|
|
struct work *work; |
|
|
|
int ts; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cp = current_pool(); |
|
|
|
cp = current_pool(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* If the primary pool is a getwork pool and cannot roll work,
|
|
|
|
|
|
|
|
* try to stage one extra work per mining thread */ |
|
|
|
|
|
|
|
if (!cp->has_stratum && !cp->has_gbt && !staged_rollable) |
|
|
|
|
|
|
|
max_staged += mining_threads; |
|
|
|
|
|
|
|
|
|
|
|
mutex_lock(stgd_lock); |
|
|
|
mutex_lock(stgd_lock); |
|
|
|
ts = __total_staged(); |
|
|
|
ts = __total_staged(); |
|
|
|
|
|
|
|
|
|
|
@ -3067,12 +3072,13 @@ static void *getwork_thread(void __maybe_unused *userdata) |
|
|
|
lagging = true; |
|
|
|
lagging = true; |
|
|
|
|
|
|
|
|
|
|
|
/* Wait until hash_pop tells us we need to create more work */ |
|
|
|
/* Wait until hash_pop tells us we need to create more work */ |
|
|
|
if (ts > opt_queue) { |
|
|
|
if (ts > max_staged) { |
|
|
|
pthread_cond_wait(&gws_cond, stgd_lock); |
|
|
|
pthread_cond_wait(&gws_cond, stgd_lock); |
|
|
|
ts = __total_staged(); |
|
|
|
ts = __total_staged(); |
|
|
|
} |
|
|
|
} |
|
|
|
mutex_unlock(stgd_lock); |
|
|
|
mutex_unlock(stgd_lock); |
|
|
|
if (ts > opt_queue) |
|
|
|
|
|
|
|
|
|
|
|
if (ts > max_staged) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
work = make_work(); |
|
|
|
work = make_work(); |
|
|
|