Browse Source

If pthread_cancel is missing/emulated, set asynchronous thread cancel type on stage, watchdog, watchpool, and longpoll threads since the emulation cannot support deferred cancellation

Luke Dashjr 13 years ago
parent
commit
ee064d88e4
1 changed files with 16 additions and 0 deletions
  1. 16 0
      miner.c

+ 16 - 0
miner.c

@@ -4516,6 +4516,10 @@ static void *stage_thread(void *userdata)
 	struct thr_info *mythr = userdata;
 	struct thr_info *mythr = userdata;
 	bool ok = true;
 	bool ok = true;
 
 
+#ifndef HAVE_PTHREAD_CANCEL
+	pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+#endif
+
 	RenameThread("stage");
 	RenameThread("stage");
 
 
 	while (ok) {
 	while (ok) {
@@ -6707,6 +6711,10 @@ static void *longpoll_thread(void *userdata)
 	char *lp_url;
 	char *lp_url;
 	int rolltime;
 	int rolltime;
 
 
+#ifndef HAVE_PTHREAD_CANCEL
+	pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+#endif
+
 	RenameThread("longpoll");
 	RenameThread("longpoll");
 
 
 	curl = curl_easy_init();
 	curl = curl_easy_init();
@@ -6891,6 +6899,10 @@ static void *watchpool_thread(void __maybe_unused *userdata)
 {
 {
 	int intervals = 0;
 	int intervals = 0;
 
 
+#ifndef HAVE_PTHREAD_CANCEL
+	pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+#endif
+
 	RenameThread("watchpool");
 	RenameThread("watchpool");
 
 
 	while (42) {
 	while (42) {
@@ -6970,6 +6982,10 @@ static void *watchdog_thread(void __maybe_unused *userdata)
 	const unsigned int interval = WATCHDOG_INTERVAL;
 	const unsigned int interval = WATCHDOG_INTERVAL;
 	struct timeval zero_tv;
 	struct timeval zero_tv;
 
 
+#ifndef HAVE_PTHREAD_CANCEL
+	pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+#endif
+
 	RenameThread("watchdog");
 	RenameThread("watchdog");
 
 
 	memset(&zero_tv, 0, sizeof(struct timeval));
 	memset(&zero_tv, 0, sizeof(struct timeval));