1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-02-02 01:44:23 +00:00

fix test/set of thr->pth to also work in windows

This commit is contained in:
Kano 2011-12-27 18:33:49 +11:00
parent 4f879b4286
commit 5033dcd355
4 changed files with 11 additions and 5 deletions

2
README
View File

@ -282,7 +282,7 @@ dedicated to this program,
The output line shows the following: The output line shows the following:
(5s):1713.6 (avg):1707.8 Mh/s | Q:301 A:729 R:8 HW:0 E:242% U:22.53/m (5s):1713.6 (avg):1707.8 Mh/s | Q:301 A:729 R:8 HW:0 E:242% U:22.53/m
Each column is as folloss: Each column is as follows:
A 5 second exponentially decaying average hash rate A 5 second exponentially decaying average hash rate
An all time average hash rate An all time average hash rate
The number of requested (Queued) work items from the pools The number of requested (Queued) work items from the pools

4
main.c
View File

@ -3785,7 +3785,7 @@ static void *api_thread(void *userdata)
api(); api();
mythr->pth = 0L; PTH(mythr) = 0L;
return NULL; return NULL;
} }
@ -4925,7 +4925,7 @@ static void *longpoll_thread(void *userdata)
pool = select_longpoll_pool(); pool = select_longpoll_pool();
new_longpoll: new_longpoll:
if (!pool->hdr_path) { if (!pool) {
applog(LOG_WARNING, "No long-poll found on any pool server"); applog(LOG_WARNING, "No long-poll found on any pool server");
goto out; goto out;
} }

View File

@ -237,6 +237,12 @@ struct cgpu_info {
#endif #endif
}; };
#ifndef WIN32
#define PTH(thr) ((thr)->pth)
#else
#define PTH(thr) ((thr)->pth.p)
#endif
struct thread_q { struct thread_q {
struct list_head q; struct list_head q;

4
util.c
View File

@ -681,10 +681,10 @@ void thr_info_cancel(struct thr_info *thr)
if (thr->q) if (thr->q)
tq_freeze(thr->q); tq_freeze(thr->q);
if (thr->pth) { if (PTH(thr) != 0L) {
if (!pthread_cancel(thr->pth)) if (!pthread_cancel(thr->pth))
pthread_join(thr->pth, NULL); pthread_join(thr->pth, NULL);
thr->pth = 0L; PTH(thr) = 0L;
} }
} }