Created
January 4, 2018 09:51
-
-
Save afxgroup/88598aef4f2c768955b7bd939709e738 to your computer and use it in GitHub Desktop.
Thread patch to enable posix threads on gcc AmigaOS4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/libstdc++-v3/config/io/c_io_stdio.h b/libstdc++-v3/config/io/c_io_stdio.h | |
index 8a4b453..29e694c 100644 | |
--- a/libstdc++-v3/config/io/c_io_stdio.h | |
+++ b/libstdc++-v3/config/io/c_io_stdio.h | |
@@ -33,13 +33,21 @@ | |
#define _GLIBCXX_CXX_IO_H 1 | |
#include <cstdio> | |
+#ifndef __amigaos4__ | |
#include <bits/gthr.h> | |
+#else | |
+#include <bits/gthr-posix.h> | |
+#endif | |
namespace std _GLIBCXX_VISIBILITY(default) | |
{ | |
_GLIBCXX_BEGIN_NAMESPACE_VERSION | |
+#ifndef __amigaos4__ | |
typedef __gthread_mutex_t __c_lock; | |
+#else | |
+ typedef pthread_mutex_t __c_lock; | |
+#endif | |
// for basic_file.h | |
typedef FILE __c_file; | |
diff --git a/libstdc++-v3/config/os/amigaos/os_defines.h b/libstdc++-v3/config/os/amigaos/os_defines.h | |
index 6b67630..6d0f0f0 100644 | |
--- a/libstdc++-v3/config/os/amigaos/os_defines.h | |
+++ b/libstdc++-v3/config/os/amigaos/os_defines.h | |
@@ -39,6 +39,7 @@ | |
#ifdef __NEWLIB__ | |
#define _GLIBCXX_USE_C99_STDINT_TR1 1 | |
#define _GLIBCXX_USE_C99 1 | |
+#define _GLIBCXX_HAS_GTHREADS 1 | |
/* Temporary until newlib behaves properly */ | |
#undef __STRICT_ANSI__ | |
#endif | |
diff --git a/libstdc++-v3/include/ext/atomicity.h b/libstdc++-v3/include/ext/atomicity.h | |
index aff33f8..a53c120 100644 | |
--- a/libstdc++-v3/include/ext/atomicity.h | |
+++ b/libstdc++-v3/include/ext/atomicity.h | |
@@ -32,7 +32,11 @@ | |
#pragma GCC system_header | |
#include <bits/c++config.h> | |
+#ifndef __amigaos4__ | |
#include <bits/gthr.h> | |
+#else | |
+#include <bits/gthr-posix.h> | |
+#endif | |
#include <bits/atomic_word.h> | |
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) | |
diff --git a/libstdc++-v3/include/ext/concurrence.h b/libstdc++-v3/include/ext/concurrence.h | |
index 10e5700..9ffe393 100644 | |
--- a/libstdc++-v3/include/ext/concurrence.h | |
+++ b/libstdc++-v3/include/ext/concurrence.h | |
@@ -32,7 +32,11 @@ | |
#pragma GCC system_header | |
#include <exception> | |
+#ifndef __amigaos4__ | |
#include <bits/gthr.h> | |
+#else | |
+#include <bits/gthr-posix.h> | |
+#endif | |
#include <bits/functexcept.h> | |
#include <bits/cpp_type_traits.h> | |
#include <ext/type_traits.h> | |
diff --git a/libstdc++-v3/include/ext/rope b/libstdc++-v3/include/ext/rope | |
index b982dc8..9341d53 100644 | |
--- a/libstdc++-v3/include/ext/rope | |
+++ b/libstdc++-v3/include/ext/rope | |
@@ -52,7 +52,11 @@ | |
#include <bits/stl_function.h> | |
#include <bits/stl_numeric.h> | |
#include <bits/allocator.h> | |
+#ifndef __amigaos4__ | |
#include <bits/gthr.h> | |
+#else | |
+#include <bits/gthr-posix.h> | |
+#endif | |
#include <tr1/functional> | |
# ifdef __GC | |
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex | |
index b80a8a0..d952695 100644 | |
--- a/libstdc++-v3/include/std/mutex | |
+++ b/libstdc++-v3/include/std/mutex | |
@@ -42,7 +42,11 @@ | |
#include <functional> | |
#include <system_error> | |
#include <bits/functexcept.h> | |
+#ifndef __amigaos4__ | |
#include <bits/gthr.h> | |
+#else | |
+#include <bits/gthr-posix.h> | |
+#endif | |
#include <bits/move.h> // for std::swap | |
#include <bits/cxxabi_forced.h> | |
diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread | |
index 34e15e8..be8fcc7 100644 | |
--- a/libstdc++-v3/include/std/thread | |
+++ b/libstdc++-v3/include/std/thread | |
@@ -40,7 +40,11 @@ | |
#include <memory> | |
#include <bits/functexcept.h> | |
#include <bits/functional_hash.h> | |
+#ifndef __amigaos4__ | |
#include <bits/gthr.h> | |
+#else | |
+#include <bits/gthr-posix.h> | |
+#endif | |
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) | |
diff --git a/libstdc++-v3/src/c++11/condition_variable.cc b/libstdc++-v3/src/c++11/condition_variable.cc | |
index cc0f6e4..7e2eff4 100644 | |
--- a/libstdc++-v3/src/c++11/condition_variable.cc | |
+++ b/libstdc++-v3/src/c++11/condition_variable.cc | |
@@ -26,7 +26,6 @@ | |
#include <cstdlib> | |
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) | |
- | |
namespace std _GLIBCXX_VISIBILITY(default) | |
{ | |
_GLIBCXX_BEGIN_NAMESPACE_VERSION | |
diff --git a/libstdc++-v3/src/c++11/thread.cc b/libstdc++-v3/src/c++11/thread.cc | |
index 7fa415b..471cb24 100644 | |
--- a/libstdc++-v3/src/c++11/thread.cc | |
+++ b/libstdc++-v3/src/c++11/thread.cc | |
@@ -59,7 +59,7 @@ static inline int get_nprocs() | |
#endif | |
#ifndef _GLIBCXX_USE_NANOSLEEP | |
-# ifdef _GLIBCXX_HAVE_SLEEP | |
+# if defined(_GLIBCXX_HAVE_SLEEP) || defined(__amigaos4__) | |
# include <unistd.h> | |
# elif defined(_GLIBCXX_HAVE_WIN32_SLEEP) | |
# include <windows.h> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment