"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Quentin Rameau <quinq@fifth.space>
Subject:
[PATCH] tog: fix usage of deprecated pthread_yield
To:
gameoftrees@openbsd.org
Date:
Sun, 19 Sep 2021 16:05:59 +0200

Download raw body.

Thread
The pthread_yield isn't portable, let's use the POSIX equivalent
instead.
---
Indeed, I had forgotten to add the correct header for sched_yield(),
that is fixed in this second revision of the patch.
---
 tog/tog.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tog/tog.c b/tog/tog.c
index 5af8f69f..c805748e 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -38,6 +38,7 @@
 #include <pthread.h>
 #include <libgen.h>
 #include <regex.h>
+#include <sched.h>
 
 #include "got_compat.h"
 
@@ -848,7 +849,7 @@ view_input(struct tog_view **new, int *done, struct tog_view *view,
 		if (errcode)
 			return got_error_set_errno(errcode,
 			    "pthread_mutex_unlock");
-		pthread_yield();
+		sched_yield();
 		errcode = pthread_mutex_lock(&tog_mutex);
 		if (errcode)
 			return got_error_set_errno(errcode,
-- 
2.33.0