OLD | NEW |
1 /* Threads compatibility routines for libgcc2 and libobjc. */ | 1 /* Threads compatibility routines for libgcc2 and libobjc. */ |
2 /* Compile this one with gcc. */ | 2 /* Compile this one with gcc. */ |
3 /* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 | 3 /* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 |
4 Free Software Foundation, Inc. | 4 Free Software Foundation, Inc. |
5 | 5 |
6 This file is part of GCC. | 6 This file is part of GCC. |
7 | 7 |
8 GCC is free software; you can redistribute it and/or modify it under | 8 GCC is free software; you can redistribute it and/or modify it under |
9 the terms of the GNU General Public License as published by the Free | 9 the terms of the GNU General Public License as published by the Free |
10 Software Foundation; either version 2, or (at your option) any later | 10 Software Foundation; either version 2, or (at your option) any later |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 static inline int | 110 static inline int |
111 __gthread_active_p (void) | 111 __gthread_active_p (void) |
112 { | 112 { |
113 /* | 113 /* |
114 * The threading library is active if a basic thread creation/destruction | 114 * The threading library is active if a basic thread creation/destruction |
115 * primitive is referenced. Unfortunately we don't have those yet. | 115 * primitive is referenced. Unfortunately we don't have those yet. |
116 * TODO: change to reference a thread creation/destruction function | 116 * TODO: change to reference a thread creation/destruction function |
117 * when one becomes available. | 117 * when one becomes available. |
118 */ | 118 */ |
119 // This is a dirty workaround over our inability to use locks in NaCl x86-64. | |
120 // TODO(pasko): fix this by enabling correct builtins. | |
121 #ifndef __x86_64__ | |
122 static void *const __gthread_active_ptr | 119 static void *const __gthread_active_ptr |
123 = __extension__ (void *) &__gthrw_(pthread_mutex_lock); | 120 = __extension__ (void *) &__gthrw_(pthread_mutex_lock); |
124 return __gthread_active_ptr != 0; | 121 return __gthread_active_ptr != 0; |
125 #else | |
126 return 0; | |
127 #endif | |
128 } | 122 } |
129 | 123 |
130 #ifdef _LIBOBJC | 124 #ifdef _LIBOBJC |
131 | 125 |
132 /* This is the config.h file in libobjc/ */ | 126 /* This is the config.h file in libobjc/ */ |
133 #include <config.h> | 127 #include <config.h> |
134 | 128 |
135 #ifdef HAVE_SCHED_H | 129 #ifdef HAVE_SCHED_H |
136 # include <sched.h> | 130 # include <sched.h> |
137 #endif | 131 #endif |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 | 544 |
551 static inline int | 545 static inline int |
552 __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex) | 546 __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex) |
553 { | 547 { |
554 return __gthread_mutex_unlock (mutex); | 548 return __gthread_mutex_unlock (mutex); |
555 } | 549 } |
556 | 550 |
557 #endif /* _LIBOBJC */ | 551 #endif /* _LIBOBJC */ |
558 | 552 |
559 #endif /* ! GCC_GTHR_POSIX_H */ | 553 #endif /* ! GCC_GTHR_POSIX_H */ |
OLD | NEW |