summaryrefslogtreecommitdiff
path: root/ppc-amigaos/recipes/patches/gcc/0007-Some-AmigaOS-4.x-compability-changes-for-posix-threa.p
blob: 87b8e7776bdc3c2db236bd26721c09ca5e35135b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
From 213fc9c82cbd5935a67a991a753478994b9eb968 Mon Sep 17 00:00:00 2001
From: Sebastian Bauer <mail@sebastianbauer.info>
Date: Thu, 21 Jan 2016 20:46:59 +0100
Subject: [PATCH 7/9] Some AmigaOS 4.x compability changes for posix thread
 support.

---
 libgcc/gthr-posix.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libgcc/gthr-posix.h b/libgcc/gthr-posix.h
index 555c0fe2458fa3e0e96d769d3f36ae35db47e1bb..daee24052b68cea2159d68abd6cf6817e0d7a81b 100644
--- libgcc/gthr-posix.h
+++ libgcc/gthr-posix.h
@@ -29,12 +29,16 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 /* POSIX threads specific definitions.
    Easy, since the interface is just one-to-one mapping.  */
 
 #define __GTHREADS 1
 #define __GTHREADS_CXX0X 1
 
+#ifdef __amigaos4__
+#include <exec/types.h>
+#endif
+
 #include <pthread.h>
 
 #if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \
      || !defined(_GTHREAD_USE_MUTEX_TIMEDLOCK))
 # include <unistd.h>
 # if defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0
@@ -107,13 +111,15 @@ __gthrw(pthread_join)
 __gthrw(pthread_equal)
 __gthrw(pthread_self)
 __gthrw(pthread_detach)
 #ifndef __BIONIC__
 __gthrw(pthread_cancel)
 #endif
+#ifndef __amigaos4__
 __gthrw(sched_yield)
+#endif
 
 __gthrw(pthread_mutex_lock)
 __gthrw(pthread_mutex_trylock)
 #if _GTHREAD_USE_MUTEX_TIMEDLOCK
 __gthrw(pthread_mutex_timedlock)
 #endif
@@ -444,14 +450,16 @@ __gthread_objc_thread_get_priority (void)
 }
 
 /* Yield our process time to another thread.  */
 static inline void
 __gthread_objc_thread_yield (void)
 {
+#ifndef __amigaos4__
   if (__gthread_active_p ())
     __gthrw_(sched_yield) ();
+#endif
 }
 
 /* Terminate the current thread.  */
 static inline int
 __gthread_objc_thread_exit (void)
 {
@@ -686,13 +694,17 @@ __gthread_self (void)
   return __gthrw_(pthread_self) ();
 }
 
 static inline int
 __gthread_yield (void)
 {
+#ifdef __amigaos4__
+  return 1;
+#else
   return __gthrw_(sched_yield) ();
+#endif
 }
 
 static inline int
 __gthread_once (__gthread_once_t *__once, void (*__func) (void))
 {
   if (__gthread_active_p ())
-- 
1.9.1