1 // Compatibility symbols for previous versions, C++0x bits -*- C++ -*-
3 // Copyright (C) 2009-2024 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
25 #include <bits/c++config.h>
26 #if defined(_GLIBCXX_SHARED)
27 #define _GLIBCXX_ASYNC_ABI_COMPAT
34 #if __cplusplus < 201103L
35 # error "compatibility-thread-c++0x.cc must be compiled with -std=gnu++0x"
38 #if _GLIBCXX_INLINE_VERSION
39 # error "compatibility-thread-c++0x.cc is not needed for gnu-versioned-namespace"
42 #define _GLIBCXX_ASM_SYMVER(cur, old, version) \
43 asm (".symver " #cur "," #old "@@@" #version);
45 // XXX GLIBCXX_ABI Deprecated
47 // <future> export changes
48 #if defined(_GLIBCXX_SYMVER_GNU) && defined(_GLIBCXX_SHARED) \
49 && defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) \
50 && defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT)
52 namespace __gnu_cxx
_GLIBCXX_VISIBILITY(default)
54 const std::error_category
* future_category
= &std::future_category();
57 _GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx15future_categoryE
, _ZSt15future_category
, GLIBCXX_3
.4
.14)
61 // XXX GLIBCXX_ABI Deprecated
63 // <mutex> export changes
64 #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
65 #if defined(_GLIBCXX_SYMVER_GNU) && defined(_GLIBCXX_SHARED) \
66 && defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) \
67 && defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT)
69 namespace __gnu_cxx
_GLIBCXX_VISIBILITY(default)
71 std::defer_lock_t defer_lock
;
72 std::try_to_lock_t try_to_lock
;
73 std::adopt_lock_t adopt_lock
;
76 _GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx10adopt_lockE
, _ZSt10adopt_lock
, GLIBCXX_3
.4
.11)
77 _GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx10defer_lockE
, _ZSt10defer_lock
, GLIBCXX_3
.4
.11)
78 _GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx11try_to_lockE
, _ZSt11try_to_lock
, GLIBCXX_3
.4
.11)
82 #endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
85 // XXX GLIBCXX_ABI Deprecated
86 // gcc-4.7.0, gcc-4.9.0
87 // <future> export changes
88 #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
89 && (ATOMIC_INT_LOCK_FREE > 1)
90 #if defined(_GLIBCXX_SHARED)
91 namespace std
_GLIBCXX_VISIBILITY(default)
93 _GLIBCXX_BEGIN_NAMESPACE_VERSION
94 // Replaced by _State_baseV2 in gcc-4.9.0
95 class __future_base::_State_base
97 typedef _Ptr
<_Result_base
> _Ptr_type
;
101 condition_variable _M_cond
;
102 atomic_flag _M_retrieved
;
105 virtual ~_State_base();
106 virtual void _M_run_deferred() { }
108 __future_base::_State_base::~_State_base() { }
110 // Replaced by _Async_state_commonV2 in gcc-4.9.0
111 class __future_base::_Async_state_common
: public __future_base::_State_base
114 ~_Async_state_common();
115 virtual void _M_run_deferred() { _M_join(); }
116 void _M_join() { std::call_once(_M_once
, &thread::join
, &_M_thread
); }
120 #if defined(_GLIBCXX_HAVE_TLS)
121 // Replaced with inline definition in gcc-4.8.0
122 __future_base::_Async_state_common::~_Async_state_common() { _M_join(); }
124 // Explicit instantiation due to -fno-implicit-templates.
125 template void call_once(once_flag
&, void (thread::*&&)(), thread
*&&);
126 #endif // _GLIBCXX_HAVE_TLS
127 _GLIBCXX_END_NAMESPACE_VERSION
129 #endif // _GLIBCXX_SHARED
130 #endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1