From a1339d723f1051e10decfc60a454b3ae39fcc0a2 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 16 Jul 2011 11:06:58 +1000 Subject: [PATCH] Only pthread_join the mining threads if they exist as determined by pthread_cancel. --- main.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/main.c b/main.c index b070e063..1f14c9c2 100644 --- a/main.c +++ b/main.c @@ -1880,13 +1880,8 @@ static void reinit_cputhread(int thr_id) struct thr_info *thr = &thr_info[thr_id]; tq_freeze(thr->q); - if (unlikely(pthread_cancel(thr->pth))) { - applog(LOG_ERR, "Failed to pthread_cancel in reinit_gputhread"); - goto failed_out; - } - - if (unlikely(pthread_join(thr->pth, NULL))) { - applog(LOG_ERR, "Failed to pthread_join in reinit_gputhread"); + if (!(pthread_cancel(thr->pth)) && pthread_join(thr->pth, NULL)) { + applog(LOG_ERR, "Failed to pthread_join in reinit_cputhread"); goto failed_out; } @@ -1913,11 +1908,7 @@ static void reinit_gputhread(int thr_id) char name[256]; tq_freeze(thr->q); - if (unlikely(pthread_cancel(thr->pth))) { - applog(LOG_ERR, "Failed to pthread_cancel in reinit_gputhread"); - goto failed_out; - } - if (unlikely(pthread_join(thr->pth, NULL))) { + if (!(pthread_cancel(thr->pth)) && pthread_join(thr->pth, NULL)) { applog(LOG_ERR, "Failed to pthread_join in reinit_gputhread"); goto failed_out; }