package/libcurl: fix build without sched_yield

Fix the following build failure without sched_yield raised since bump to
version 7.84.0 in commit b034109dd6:

In file included from easy.c:89:
easy_lock.h: In function 'curl_simple_lock_lock':
easy_lock.h:56:7: error: implicit declaration of function 'sched_yield' [-Werror=implicit-function-declaration]
   56 |       sched_yield();
      |       ^~~~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/fbc80a0002d640210c81a4c518856c02669059b7

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Reviewed-by: Baruch Siach <baruch@tkos.co.il>
Tested-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Fabrice Fontaine 2022-07-03 17:53:56 +02:00 committed by Peter Korsgaard
parent b1d6180442
commit a5adc9b658

View File

@ -0,0 +1,30 @@
From e2e7f54b7bea521fa8373095d0f43261a720cda0 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Mon, 27 Jun 2022 08:46:21 +0200
Subject: [PATCH] easy_lock.h: include sched.h if available to fix build
Patched-by: Harry Sintonen
Closes #9054
[Retrieved from:
https://github.com/curl/curl/commit/e2e7f54b7bea521fa8373095d0f43261a720cda0]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
lib/easy_lock.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/easy_lock.h b/lib/easy_lock.h
index 819f50ce815b8..1f54289ceb2d3 100644
--- a/lib/easy_lock.h
+++ b/lib/easy_lock.h
@@ -36,6 +36,9 @@
#elif defined (HAVE_ATOMIC)
#include <stdatomic.h>
+#if defined(HAVE_SCHED_YIELD)
+#include <sched.h>
+#endif
#define curl_simple_lock atomic_bool
#define CURL_SIMPLE_LOCK_INIT false