544be2beb1
The Profile Mode extension is not used by anybody, nor maintained by anybody. The containers do not support the full API specified in recent standards, and so enabling Profile Mode is not source compatible with much modern C++ code. The heuristics that would check the profile information and make useful suggestions never materialized, so it isn't useful. It should be removed. Remove Profile Mode, deprecated since 7.1.0 * doc/Makefile.am: Remove XML file for profile mode docs. * doc/Makefile.in: Regenerate. * doc/xml/authors.xml: Remove authors of profile mode docs. * doc/xml/manual/appendix_contributing.xml: Remove mention of profile mode. * doc/xml/manual/debug.xml: Likewise. * doc/xml/manual/evolution.xml: Document removal of profile mode. * doc/xml/manual/profile_mode.xml: Remove profile mode docs. * doc/xml/manual/spine.xml: Remove profile mode author credit. * doc/xml/manual/test.xml: Remove docs for dg-require-profile-mode directive. * doc/xml/manual/using.xml: Remove docs for profile mode headers and macro. * doc/html/*: Regenerate. * include/Makefile.am: Remove profile mode headers. * include/Makefile.in: Regenerate. * include/bits/c++config (std::__profile): Remove namespace. [_GLIBCXX_PROFILE]: Remove checks for macro. * include/profile/array: Remove. * include/profile/base.h: Remove. * include/profile/bitset: Remove. * include/profile/deque: Remove. * include/profile/forward_list: Remove. * include/profile/impl/profiler.h: Remove. * include/profile/impl/profiler_algos.h: Remove. * include/profile/impl/profiler_container_size.h: Remove. * include/profile/impl/profiler_hash_func.h: Remove. * include/profile/impl/profiler_hashtable_size.h: Remove. * include/profile/impl/profiler_list_to_slist.h: Remove. * include/profile/impl/profiler_list_to_vector.h: Remove. * include/profile/impl/profiler_map_to_unordered_map.h: Remove. * include/profile/impl/profiler_node.h: Remove. * include/profile/impl/profiler_state.h: Remove. * include/profile/impl/profiler_trace.h: Remove. * include/profile/impl/profiler_vector_size.h: Remove. * include/profile/impl/profiler_vector_to_list.h: Remove. * include/profile/iterator_tracker.h: Remove. * include/profile/list: Remove. * include/profile/map: Remove. * include/profile/map.h: Remove. * include/profile/multimap.h: Remove. * include/profile/multiset.h: Remove. * include/profile/ordered_base.h: Remove. * include/profile/set: Remove. * include/profile/set.h: Remove. * include/profile/unordered_base.h: Remove. * include/profile/unordered_map: Remove. * include/profile/unordered_set: Remove. * include/profile/vector: Remove. * scripts/run_doxygen: Do not process profile mode headers. * testsuite/23_containers/array/element_access/60497.cc: Don't use profile mode type. * testsuite/23_containers/array/specialized_algorithms/swap_cxx17.cc: Remove dg-skip-if for profile mode. * testsuite/23_containers/forward_list/capacity/1.cc: Remove preprocessor check for profile mode. * testsuite/23_containers/list/capacity/29134.cc: Likewise. * testsuite/23_containers/map/modifiers/extract.cc: Remove dg-skip-if for profile mode. * testsuite/23_containers/map/modifiers/insert_or_assign/1.cc: Likewise. * testsuite/23_containers/map/modifiers/try_emplace/1.cc: Likewise. * testsuite/23_containers/multimap/modifiers/extract.cc: Likewise. * testsuite/23_containers/multiset/modifiers/extract.cc: Likewise. * testsuite/23_containers/set/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_map/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_multimap/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_multiset/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_set/modifiers/extract.cc: Likewise. * testsuite/23_containers/vector/bool/capacity/29134.cc: Remove preprocessor check for profile mode. * testsuite/23_containers/vector/bool/modifiers/insert/31370.cc: Likewise. * testsuite/23_containers/vector/modifiers/insert_vs_emplace.cc: Remove dg-skip-if for profile mode. * testsuite/25_algorithms/binary_search/partitioned.cc: Likewise. * testsuite/25_algorithms/equal_range/partitioned.cc: Likewise. * testsuite/25_algorithms/lexicographical_compare/71545.cc: Likewise. * testsuite/25_algorithms/lower_bound/partitioned.cc: Likewise. * testsuite/25_algorithms/upper_bound/partitioned.cc: Likewise. * testsuite/Makefile.am: Remove profile_flags variable and * testsuite/Makefile.am: Remove profile_flags variable and check-profile target. * testsuite/Makefile.in: Regenerate. * testsuite/ext/profile/all.cc: Remove. * testsuite/ext/profile/mutex_extensions_neg.cc: Remove. * testsuite/ext/profile/profiler_algos.cc: Remove. * testsuite/ext/profile/replace_new.cc: Remove. * testsuite/ext/throw_allocator/deallocate_global.cc: Remove preprocessor check for profile mode. * testsuite/ext/throw_allocator/deallocate_local.cc: Likewise. * testsuite/lib/libstdc++.exp (check_v3_target_profile_mode): Remove. (check_v3_target_normal_mode): Do not check for profile mode macro. * testsuite/libstdc++-prettyprinters/80276.cc: Remove dg-skip-if for profile mode. * testsuite/libstdc++-prettyprinters/compat.cc: Likewise. * testsuite/libstdc++-prettyprinters/cxx11.cc: Likewise. * testsuite/libstdc++-prettyprinters/cxx17.cc: Likewise. * testsuite/libstdc++-prettyprinters/debug.cc: Likewise. * testsuite/libstdc++-prettyprinters/debug_cxx11.cc: Likewise. * testsuite/libstdc++-prettyprinters/libfundts.cc: Likewise. * testsuite/libstdc++-prettyprinters/simple.cc: Likewise. * testsuite/libstdc++-prettyprinters/simple11.cc: Likewise. * testsuite/libstdc++-prettyprinters/whatis.cc: Likewise. * testsuite/libstdc++-prettyprinters/whatis2.cc: Likewise. From-SVN: r271120
93 lines
7.9 KiB
HTML
93 lines
7.9 KiB
HTML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 29. Concurrency</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="ext_demangling.html" title="Chapter 28. Demangling" /><link rel="next" href="ext_concurrency_impl.html" title="Implementation" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 29. Concurrency</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_demangling.html">Prev</a> </td><th width="60%" align="center">Part III.
|
||
Extensions
|
||
|
||
</th><td width="20%" align="right"> <a accesskey="n" href="ext_concurrency_impl.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.concurrency"></a>Chapter 29. Concurrency</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="ext_concurrency.html#manual.ext.concurrency.design">Design</a></span></dt><dd><dl><dt><span class="section"><a href="ext_concurrency.html#manual.ext.concurrency.design.threads">Interface to Locks and Mutexes</a></span></dt><dt><span class="section"><a href="ext_concurrency.html#manual.ext.concurrency.design.atomics">Interface to Atomic Functions</a></span></dt></dl></dd><dt><span class="section"><a href="ext_concurrency_impl.html">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="ext_concurrency_impl.html#manual.ext.concurrency.impl.atomic_fallbacks">Using Built-in Atomic Functions</a></span></dt><dt><span class="section"><a href="ext_concurrency_impl.html#manual.ext.concurrency.impl.thread">Thread Abstraction</a></span></dt></dl></dd><dt><span class="section"><a href="ext_concurrency_use.html">Use</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.concurrency.design"></a>Design</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.concurrency.design.threads"></a>Interface to Locks and Mutexes</h3></div></div></div><p>The file <code class="filename"><ext/concurrence.h></code>
|
||
contains all the higher-level
|
||
constructs for playing with threads. In contrast to the atomics layer,
|
||
the concurrence layer consists largely of types. All types are defined within <code class="code">namespace __gnu_cxx</code>.
|
||
</p><p>
|
||
These types can be used in a portable manner, regardless of the
|
||
specific environment. They are carefully designed to provide optimum
|
||
efficiency and speed, abstracting out underlying thread calls and
|
||
accesses when compiling for single-threaded situations (even on hosts
|
||
that support multiple threads.)
|
||
</p><p>The enumerated type <code class="code">_Lock_policy</code> details the set of
|
||
available locking
|
||
policies: <code class="code">_S_single</code>, <code class="code">_S_mutex</code>,
|
||
and <code class="code">_S_atomic</code>.
|
||
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="code">_S_single</code></p><p>Indicates single-threaded code that does not need locking.
|
||
</p></li><li class="listitem"><p><code class="code">_S_mutex</code></p><p>Indicates multi-threaded code using thread-layer abstractions.
|
||
</p></li><li class="listitem"><p><code class="code">_S_atomic</code></p><p>Indicates multi-threaded code using atomic operations.
|
||
</p></li></ul></div><p>The compile-time constant <code class="code">__default_lock_policy</code> is set
|
||
to one of the three values above, depending on characteristics of the
|
||
host environment and the current compilation flags.
|
||
</p><p>Two more datatypes make up the rest of the
|
||
interface: <code class="code">__mutex</code>, and <code class="code">__scoped_lock</code>.
|
||
</p><p>The scoped lock idiom is well-discussed within the C++
|
||
community. This version takes a <code class="code">__mutex</code> reference, and
|
||
locks it during construction of <code class="code">__scoped_lock</code> and
|
||
unlocks it during destruction. This is an efficient way of locking
|
||
critical sections, while retaining exception-safety.
|
||
These types have been superseded in the ISO C++ 2011 standard by the
|
||
mutex and lock types defined in the header
|
||
<code class="filename"><mutex></code>.
|
||
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.concurrency.design.atomics"></a>Interface to Atomic Functions</h3></div></div></div><p>
|
||
Two functions and one type form the base of atomic support.
|
||
</p><p>The type <code class="code">_Atomic_word</code> is a signed integral type
|
||
supporting atomic operations.
|
||
</p><p>
|
||
The two functions functions are:
|
||
</p><pre class="programlisting">
|
||
_Atomic_word
|
||
__exchange_and_add_dispatch(volatile _Atomic_word*, int);
|
||
|
||
void
|
||
__atomic_add_dispatch(volatile _Atomic_word*, int);
|
||
</pre><p>Both of these functions are declared in the header file
|
||
<ext/atomicity.h>, and are in <code class="code">namespace __gnu_cxx</code>.
|
||
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
|
||
<code class="code">
|
||
__exchange_and_add_dispatch
|
||
</code>
|
||
</p><p>Adds the second argument's value to the first argument. Returns the old value.
|
||
</p></li><li class="listitem"><p>
|
||
<code class="code">
|
||
__atomic_add_dispatch
|
||
</code>
|
||
</p><p>Adds the second argument's value to the first argument. Has no return value.
|
||
</p></li></ul></div><p>
|
||
These functions forward to one of several specialized helper
|
||
functions, depending on the circumstances. For instance,
|
||
</p><p>
|
||
<code class="code">
|
||
__exchange_and_add_dispatch
|
||
</code>
|
||
</p><p>
|
||
Calls through to either of:
|
||
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="code">__exchange_and_add</code>
|
||
</p><p>Multi-thread version. Inlined if compiler-generated builtin atomics
|
||
can be used, otherwise resolved at link time to a non-builtin code
|
||
sequence.
|
||
</p></li><li class="listitem"><p><code class="code">__exchange_and_add_single</code>
|
||
</p><p>Single threaded version. Inlined.</p></li></ul></div><p>However, only <code class="code">__exchange_and_add_dispatch</code>
|
||
and <code class="code">__atomic_add_dispatch</code> should be used. These functions
|
||
can be used in a portable manner, regardless of the specific
|
||
environment. They are carefully designed to provide optimum efficiency
|
||
and speed, abstracting out atomic accesses when they are not required
|
||
(even on hosts that support compiler intrinsics for atomic
|
||
operations.)
|
||
</p><p>
|
||
In addition, there are two macros
|
||
</p><p>
|
||
<code class="code">
|
||
_GLIBCXX_READ_MEM_BARRIER
|
||
</code>
|
||
</p><p>
|
||
<code class="code">
|
||
_GLIBCXX_WRITE_MEM_BARRIER
|
||
</code>
|
||
</p><p>
|
||
Which expand to the appropriate write and read barrier required by the
|
||
host hardware and operating system.
|
||
</p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ext_demangling.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="extensions.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ext_concurrency_impl.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 28. Demangling </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Implementation</td></tr></table></div></body></html> |