From fb7fe22e6026392ee2450aeb1b71657fd75cda43 Mon Sep 17 00:00:00 2001 From: janbar Date: Sat, 17 Feb 2024 13:45:30 +0100 Subject: [PATCH] sync upstream lib cppmyth 2.17.3 --- lib/cppmyth/CMakeLists.txt | 2 +- lib/cppmyth/src/mythsharedptr.cpp | 5 +---- lib/cppmyth/src/private/os/threads/atomic.h | 2 ++ lib/cppmyth/src/private/os/threads/latch.h | 11 +++++------ 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/cppmyth/CMakeLists.txt b/lib/cppmyth/CMakeLists.txt index 099bc798..9e3a5bd8 100644 --- a/lib/cppmyth/CMakeLists.txt +++ b/lib/cppmyth/CMakeLists.txt @@ -15,7 +15,7 @@ endif () # set lib version here set (PACKAGE_VERSION_MAJOR 2) set (PACKAGE_VERSION_MINOR 17) -set (PACKAGE_VERSION_PATCH 2) +set (PACKAGE_VERSION_PATCH 3) set (PACKAGE_VERSION ${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}) set (PACKAGE_LIB_SOVERSION ${PACKAGE_VERSION_MAJOR}) diff --git a/lib/cppmyth/src/mythsharedptr.cpp b/lib/cppmyth/src/mythsharedptr.cpp index 1fc44beb..f0cae0af 100644 --- a/lib/cppmyth/src/mythsharedptr.cpp +++ b/lib/cppmyth/src/mythsharedptr.cpp @@ -19,11 +19,8 @@ * */ -#include "local_config.h" -#include "private/os/threads/atomic.h" -#include "private/os/threads/latch.h" -#include "private/os/threads/threadpool.h" #include "mythsharedptr.h" +#include "private/os/threads/atomic.h" using namespace Myth; diff --git a/lib/cppmyth/src/private/os/threads/atomic.h b/lib/cppmyth/src/private/os/threads/atomic.h index 8057d7d3..996392d0 100644 --- a/lib/cppmyth/src/private/os/threads/atomic.h +++ b/lib/cppmyth/src/private/os/threads/atomic.h @@ -20,6 +20,8 @@ * */ +#include "../os.h" + #if __cplusplus >= 201103L #include diff --git a/lib/cppmyth/src/private/os/threads/latch.h b/lib/cppmyth/src/private/os/threads/latch.h index c3ce60bb..77b6dd4a 100644 --- a/lib/cppmyth/src/private/os/threads/latch.h +++ b/lib/cppmyth/src/private/os/threads/latch.h @@ -23,8 +23,6 @@ #include "os-threads.h" #include "atomic.h" -#define latch_bucket_count 64 - #ifdef NSROOT namespace NSROOT { #endif @@ -89,11 +87,12 @@ namespace OS void spin_lock() { - for (;;) + while (s_spin.increment() != 1) { - if (s_spin.load() == 0 && s_spin.increment() == 1) - break; - sched_yield(); + do + { + sched_yield(); + } while (s_spin.load() != 0); } } void spin_unlock() { s_spin.store(0); }