mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-10 23:08:07 +00:00
find_work() to find work in devices work queue
This commit is contained in:
parent
125194d879
commit
b3ae0f168e
18
cgminer.c
18
cgminer.c
@ -5786,6 +5786,24 @@ struct work *get_queued(struct cgpu_info *cgpu)
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct work *find_work(struct cgpu_info *cgpu, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen)
|
||||
{
|
||||
struct work *work, *tmp, *ret = NULL;
|
||||
|
||||
rd_lock(&cgpu->qlock);
|
||||
HASH_ITER(hh, cgpu->queued_work, work, tmp) {
|
||||
if (work->queued &&
|
||||
memcmp(work->midstate, midstate, midstatelen) == 0 &&
|
||||
memcmp(work->data + offset, data, datalen) == 0) {
|
||||
ret = work;
|
||||
break;
|
||||
}
|
||||
}
|
||||
rd_unlock(&cgpu->qlock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* This function should be used by queued device drivers when they're sure
|
||||
* the work struct is no longer in use. */
|
||||
void work_completed(struct cgpu_info *cgpu, struct work *work)
|
||||
|
1
miner.h
1
miner.h
@ -1183,6 +1183,7 @@ struct modminer_fpga_state {
|
||||
extern void get_datestamp(char *, struct timeval *);
|
||||
extern void submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce);
|
||||
extern struct work *get_queued(struct cgpu_info *cgpu);
|
||||
extern struct work *find_work(struct cgpu_info *cgpu, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen);
|
||||
extern void work_completed(struct cgpu_info *cgpu, struct work *work);
|
||||
extern void hash_queued_work(struct thr_info *mythr);
|
||||
extern void tailsprintf(char *f, const char *fmt, ...);
|
||||
|
Loading…
Reference in New Issue
Block a user