From e000e2703d9ca51cd712d9a64f6eaffee93a9c23 Mon Sep 17 00:00:00 2001
From: Florian Fischer <florian.fischer@muhq.space>
Date: Mon, 10 Jan 2022 15:39:58 +0100
Subject: [PATCH] [Dispatcher] replace deprecated pthread_yield with
 sched_yield

Compilation with gcc on ubuntu 21.10 fails because pthread_yield is
apparently deprecated and should be replaced with sched_yield.

gcc --version
gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0
---
 emper/Dispatcher.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/emper/Dispatcher.cpp b/emper/Dispatcher.cpp
index 0a5e4a44..2499cad0 100644
--- a/emper/Dispatcher.cpp
+++ b/emper/Dispatcher.cpp
@@ -2,7 +2,7 @@
 // Copyright © 2020 Florian Schmaus
 #include "Dispatcher.hpp"
 
-#include <pthread.h>	// for pthread_yield
+#include <sched.h>
 
 #include "Emper.hpp"
 #include "Runtime.hpp"	// for Runtime
@@ -17,6 +17,6 @@ void Dispatcher::dispatchLoopDoSleep() {
 	if constexpr (emper::WORKER_SLEEP) {
 		runtime.dispatchLoopSleep();
 	} else {
-		pthread_yield();
+		sched_yield();
 	}
 }
-- 
GitLab