1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-11 15:27:53 +00:00

Detach pthread from within the api thread in case it is terminated due to not being instantiated before pthread_cancel is called from main, leading to a segfault.

This commit is contained in:
Con Kolivas 2012-07-16 22:03:43 +10:00
parent 77b7ed4b9e
commit dd25454594

View File

@ -3370,6 +3370,7 @@ static void *api_thread(void *userdata)
{ {
struct thr_info *mythr = userdata; struct thr_info *mythr = userdata;
pthread_detach(pthread_self());
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
api(api_thr_id); api(api_thr_id);
@ -5558,8 +5559,6 @@ begin_bench:
thr = &thr_info[api_thr_id]; thr = &thr_info[api_thr_id];
if (thr_info_create(thr, NULL, api_thread, thr)) if (thr_info_create(thr, NULL, api_thread, thr))
quit(1, "API thread create failed"); quit(1, "API thread create failed");
pthread_detach(thr->pth);
#ifdef HAVE_CURSES #ifdef HAVE_CURSES
/* Create curses input thread for keyboard input. Create this last so /* Create curses input thread for keyboard input. Create this last so