aboutsummaryrefslogtreecommitdiff
path: root/gcc/gthr.h
diff options
context:
space:
mode:
authorDoug Kwan <dougkwan@google.com>2007-10-05 05:35:46 +0000
committerJason Merrill <jason@gcc.gnu.org>2007-10-05 01:35:46 -0400
commitafd82ef5ab97b47cbb9413da64a8bf6929caf25a (patch)
tree7199ead87b016c417595eb8799a0e2e438399c58 /gcc/gthr.h
parent90e965bb845a73148758d4639058a59ad0801a06 (diff)
downloadgcc-afd82ef5ab97b47cbb9413da64a8bf6929caf25a.zip
gcc-afd82ef5ab97b47cbb9413da64a8bf6929caf25a.tar.gz
gcc-afd82ef5ab97b47cbb9413da64a8bf6929caf25a.tar.bz2
gthr-posix.h (__gthread_cond_broadcast, [...]): Add to extend interface for POSIX conditional variables.
2007-09-13 Doug Kwan <dougkwan@google.com> * gcc/gthr-posix.h (__gthread_cond_broadcast, __gthread_cond_wait, __gthread_cond_wait_recursive): Add to extend interface for POSIX conditional variables. (__GTHREAD_HAS_COND): Macro defined to signify support of conditional variables. * gcc/gthr-posix95.h (__gthread_cond_broadcast, __gthread_cond_wait, __gthread_cond_wait_recursive): Add to extend interface for POSIX conditional variables. (__GTHREAD_HAS_COND): Macro defined to signify support of conditional variables. * gcc/gthr-single.h (__gthread_cond_broadcast, __gthread_cond_wait, __gthread_cond_wait_recursive): Add to extend interface for POSIX conditional variables. * gcc/gthr.h: Update comments to document new interface. * libstdc++-v3/include/ext/concurrent.h (class __mutex, class __recursive_mutex): Add new method gthread_mutex to access inner gthread mutex. [__GTHREAD_HAS_COND] (class __concurrence_broadcast_error, class __concurrence_wait_error, class __cond): Add. * guard.cc (recursive_push, recursive_pop): Delete. (init_in_progress_flag, set_init_in_progress_flag): Add to replace recursive_push and recursive_pop. (throw_recursive_init_exception): Add. (acquire, __cxa_guard_acquire, __cxa_guard_abort and __cxa_guard_release): [__GTHREAD_HAS_COND] Use a conditional for synchronization of static variable initialization. The global mutex is only held briefly when guards are accessed. [!__GTHREAD_HAS_COND] Fall back to the old code, which deadlocks. * testsuite/thread/guard.cc: Add new test. It deadlocks with the old locking code in libstdc++-v3/libsup++/guard.cc. From-SVN: r129030
Diffstat (limited to 'gcc/gthr.h')
-rw-r--r--gcc/gthr.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/gthr.h b/gcc/gthr.h
index b9d1641..a37b911 100644
--- a/gcc/gthr.h
+++ b/gcc/gthr.h
@@ -81,6 +81,24 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex);
int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex);
+ The following are supported in POSIX threads only. They are required to
+ fix a deadlock in static initialization inside libsupc++. The header file
+ gthr-posix.h defines a symbol __GTHREAD_HAS_COND to signify that these extra
+ features are supported.
+
+ Types:
+ __gthread_cond_t
+
+ Macros:
+ __GTHREAD_COND_INIT
+ __GTHREAD_COND_INIT_FUNCTION
+
+ Interface:
+ int __gthread_cond_broadcast (__gthread_cond_t *cond);
+ int __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex);
+ int __gthread_cond_wait_recursive (__gthread_cond_t *cond,
+ __gthread_recursive_mutex_t *mutex);
+
All functions returning int should return zero on success or the error
number. If the operation is not supported, -1 is returned.