aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/libstdc++-v3/libsupc++/guard.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/libstdc++-v3/libsupc++/guard.cc')
-rw-r--r--gcc-4.9/libstdc++-v3/libsupc++/guard.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc-4.9/libstdc++-v3/libsupc++/guard.cc b/gcc-4.9/libstdc++-v3/libsupc++/guard.cc
index 45de1bb13..37dcd2267 100644
--- a/gcc-4.9/libstdc++-v3/libsupc++/guard.cc
+++ b/gcc-4.9/libstdc++-v3/libsupc++/guard.cc
@@ -140,6 +140,26 @@ __set_and_release (__cxxabiv1::__guard *g)
#endif /* __GTHREADS */
+
+extern "C" void __google_potentially_blocking_region_begin(void)
+ __attribute__((weak));
+extern "C" void __google_potentially_blocking_region_end(void)
+ __attribute__((weak));
+
+struct google_potentially_blocking_region
+{
+ google_potentially_blocking_region()
+ {
+ if (&__google_potentially_blocking_region_begin != 0)
+ __google_potentially_blocking_region_begin();
+ }
+ ~google_potentially_blocking_region()
+ {
+ if (&__google_potentially_blocking_region_end != 0)
+ __google_potentially_blocking_region_end();
+ }
+};
+
//
// Here are C++ run-time routines for guarded initialization of static
// variables. There are 4 scenarios under which these routines are called:
@@ -235,6 +255,8 @@ namespace __cxxabiv1
extern "C"
int __cxa_guard_acquire (__guard *g)
{
+ google_potentially_blocking_region gpbr; // RAII
+
#ifdef __GTHREADS
// If the target can reorder loads, we need to insert a read memory
// barrier so that accesses to the guarded variable happen after the