Merge pull request #63 from kanoi/master fix test/set of thr->pth to also work in windows
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
diff --git a/README b/README
index e4e28d8..c3db4ee 100644
--- a/README
+++ b/README
@@ -282,7 +282,7 @@ dedicated to this program,
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
-Each column is as folloss:
+Each column is as follows:
A 5 second exponentially decaying average hash rate
An all time average hash rate
The number of requested (Queued) work items from the pools
diff --git a/main.c b/main.c
index 1867e68..8c4bfdb 100644
--- a/main.c
+++ b/main.c
@@ -3785,7 +3785,7 @@ static void *api_thread(void *userdata)
api();
- mythr->pth = 0L;
+ PTH(mythr) = 0L;
return NULL;
}
@@ -4925,7 +4925,7 @@ static void *longpoll_thread(void *userdata)
pool = select_longpoll_pool();
new_longpoll:
- if (!pool->hdr_path) {
+ if (!pool) {
applog(LOG_WARNING, "No long-poll found on any pool server");
goto out;
}
diff --git a/miner.h b/miner.h
index 1a83158..bd45140 100644
--- a/miner.h
+++ b/miner.h
@@ -237,6 +237,12 @@ struct cgpu_info {
#endif
};
+#ifndef WIN32
+#define PTH(thr) ((thr)->pth)
+#else
+#define PTH(thr) ((thr)->pth.p)
+#endif
+
struct thread_q {
struct list_head q;
diff --git a/util.c b/util.c
index 3df1fb3..a9a3296 100644
--- a/util.c
+++ b/util.c
@@ -681,10 +681,10 @@ void thr_info_cancel(struct thr_info *thr)
if (thr->q)
tq_freeze(thr->q);
- if (thr->pth) {
+ if (PTH(thr) != 0L) {
if (!pthread_cancel(thr->pth))
pthread_join(thr->pth, NULL);
- thr->pth = 0L;
+ PTH(thr) = 0L;
}
}