mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-10 23:08:07 +00:00
Only get extra work in fill_queue if we don't have any unqueued work in the list.
This commit is contained in:
parent
5f041e1a72
commit
97bad1eef6
10
cgminer.c
10
cgminer.c
@ -5775,11 +5775,14 @@ static void fill_queue(struct thr_info *mythr, struct cgpu_info *cgpu, struct de
|
|||||||
{
|
{
|
||||||
thread_reportout(mythr);
|
thread_reportout(mythr);
|
||||||
do {
|
do {
|
||||||
struct work *work = get_work(mythr, thr_id);
|
struct work *work;
|
||||||
|
|
||||||
work->device_diff = MIN(drv->max_diff, work->work_difficulty);
|
|
||||||
wr_lock(&cgpu->qlock);
|
wr_lock(&cgpu->qlock);
|
||||||
|
if (HASH_COUNT(cgpu->queued_work) == cgpu->queued_count) {
|
||||||
|
work = get_work(mythr, thr_id);
|
||||||
|
work->device_diff = MIN(drv->max_diff, work->work_difficulty);
|
||||||
HASH_ADD_INT(cgpu->queued_work, id, work);
|
HASH_ADD_INT(cgpu->queued_work, id, work);
|
||||||
|
}
|
||||||
wr_unlock(&cgpu->qlock);
|
wr_unlock(&cgpu->qlock);
|
||||||
/* The queue_full function should be used by the driver to
|
/* The queue_full function should be used by the driver to
|
||||||
* actually place work items on the physical device if it
|
* actually place work items on the physical device if it
|
||||||
@ -5799,6 +5802,7 @@ struct work *get_queued(struct cgpu_info *cgpu)
|
|||||||
HASH_ITER(hh, cgpu->queued_work, work, tmp) {
|
HASH_ITER(hh, cgpu->queued_work, work, tmp) {
|
||||||
if (!work->queued) {
|
if (!work->queued) {
|
||||||
work->queued = true;
|
work->queued = true;
|
||||||
|
cgpu->queued_count++;
|
||||||
ret = work;
|
ret = work;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -5849,6 +5853,8 @@ struct work *find_queued_work_bymidstate(struct cgpu_info *cgpu, char *midstate,
|
|||||||
void work_completed(struct cgpu_info *cgpu, struct work *work)
|
void work_completed(struct cgpu_info *cgpu, struct work *work)
|
||||||
{
|
{
|
||||||
wr_lock(&cgpu->qlock);
|
wr_lock(&cgpu->qlock);
|
||||||
|
if (work->queued)
|
||||||
|
cgpu->queued_count--;
|
||||||
HASH_DEL(cgpu->queued_work, work);
|
HASH_DEL(cgpu->queued_work, work);
|
||||||
wr_unlock(&cgpu->qlock);
|
wr_unlock(&cgpu->qlock);
|
||||||
free_work(work);
|
free_work(work);
|
||||||
|
Loading…
Reference in New Issue
Block a user