msgid ""
msgstr ""
"Project-Id-Version: English (Boost Unordered Translation (zh_Hans))\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-06-06 20:00+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: English <https://insights.cppalliance.org/weblate/projects/"
"boost-unordered-documentation-zh_Hans/doc-modules-root-pages-concurrent-adoc/"
"en/>\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 2026.5\n"

#: :1
#, read-only, safe-html, strict-same
msgid "﻿[#concurrent] = Concurrent Containers"
msgstr "﻿[#concurrent] = Concurrent Containers"

#: :4
#, read-only, safe-html, strict-same
msgid ":idprefix: concurrent_"
msgstr ":idprefix: concurrent_"

#: :6
#, read-only, safe-html, strict-same
msgid ""
"Boost.Unordered provides `boost::concurrent_node_set`, "
"`boost::concurrent_node_map`, `boost::concurrent_flat_set` and "
"`boost::concurrent_flat_map`, hash tables that allow concurrent write/read "
"access from different threads without having to implement any synchronzation "
"mechanism on the user's side."
msgstr ""
"Boost.Unordered provides `boost::concurrent_node_set`, "
"`boost::concurrent_node_map`, `boost::concurrent_flat_set` and "
"`boost::concurrent_flat_map`, hash tables that allow concurrent write/read "
"access from different threads without having to implement any synchronzation "
"mechanism on the user's side."

#: :36
#, read-only, safe-html, strict-same
msgid ""
"In the example above, threads access `m` without synchronization, just as "
"we'd do in a single-threaded scenario. In an ideal setting, if a given "
"workload is distributed among _N_ threads, execution is _N_ times faster "
"than with one thread —this limit is never attained in practice due to "
"synchronization overheads and _contention_ (one thread waiting for another "
"to leave a locked portion of the map), but Boost.Unordered concurrent "
"containers are designed to perform with very little overhead and typically "
"achieve _linear scaling_ (that is, performance is proportional to the number "
"of threads up to the number of logical cores in the CPU)."
msgstr ""
"In the example above, threads access `m` without synchronization, just as "
"we'd do in a single-threaded scenario. In an ideal setting, if a given "
"workload is distributed among _N_ threads, execution is _N_ times faster "
"than with one thread —this limit is never attained in practice due to "
"synchronization overheads and _contention_ (one thread waiting for another "
"to leave a locked portion of the map), but Boost.Unordered concurrent "
"containers are designed to perform with very little overhead and typically "
"achieve _linear scaling_ (that is, performance is proportional to the number "
"of threads up to the number of logical cores in the CPU)."

#: :45
#, read-only, safe-html, strict-same
msgid "Visitation-based API"
msgstr "Visitation-based API"

#: :47
#, read-only, safe-html, strict-same
msgid ""
"The first thing a new user of Boost.Unordered concurrent containers will "
"notice is that these classes _do not provide iterators_ (which makes them "
"technically not https://en.cppreference.com/w/cpp/named_req/"
"Container[Containers^] in the C++ standard sense). The reason for this is "
"that iterators are inherently thread-unsafe. Consider this hypothetical code:"
msgstr ""
"The first thing a new user of Boost.Unordered concurrent containers will "
"notice is that these classes _do not provide iterators_ (which makes them "
"technically not https://en.cppreference.com/w/cpp/named_req/"
"Container[Containers^] in the C++ standard sense). The reason for this is "
"that iterators are inherently thread-unsafe. Consider this hypothetical code:"

#: :61
#, read-only, safe-html, strict-same
msgid ""
"In a multithreaded scenario, the iterator `it` may be invalid at point B if "
"some other thread issues an `m.erase(k)` operation between A and B. There "
"are designs that can remedy this by making iterators lock the element they "
"point to, but this approach lends itself to high contention and can easily "
"produce deadlocks in a program. `operator[]` has similar concurrency issues, "
"and is not provided by `boost::concurrent_flat_map`/"
"`boost::concurrent_node_map` either. Instead, element access is done through "
"so-called _visitation functions_:"
msgstr ""
"In a multithreaded scenario, the iterator `it` may be invalid at point B if "
"some other thread issues an `m.erase(k)` operation between A and B. There "
"are designs that can remedy this by making iterators lock the element they "
"point to, but this approach lends itself to high contention and can easily "
"produce deadlocks in a program. `operator[]` has similar concurrency issues, "
"and is not provided by `boost::concurrent_flat_map`/"
"`boost::concurrent_node_map` either. Instead, element access is done through "
"so-called _visitation functions_:"

#: :76
#, read-only, safe-html, strict-same
msgid ""
"The visitation function passed by the user (in this case, a lambda function) "
"is executed internally by Boost.Unordered in a thread-safe manner, so it can "
"access the element without worrying about other threads interfering in the "
"process."
msgstr ""
"The visitation function passed by the user (in this case, a lambda function) "
"is executed internally by Boost.Unordered in a thread-safe manner, so it can "
"access the element without worrying about other threads interfering in the "
"process."

#: :81
#, read-only, safe-html, strict-same
msgid ""
"On the other hand, a visitation function can _not_ access the container "
"itself:"
msgstr ""
"On the other hand, a visitation function can _not_ access the container "
"itself:"

#: :90
#, read-only, safe-html, strict-same
msgid "Access to a different container is allowed, though:"
msgstr "Access to a different container is allowed, though:"

#: :101
#, read-only, safe-html, strict-same
msgid ""
"But, in general, visitation functions should be as lightweight as possible "
"to reduce contention and increase parallelization. In some cases, moving "
"heavy work outside of visitation may be beneficial:"
msgstr ""
"But, in general, visitation functions should be as lightweight as possible "
"to reduce contention and increase parallelization. In some cases, moving "
"heavy work outside of visitation may be beneficial:"

#: :116
#, read-only, safe-html, strict-same
msgid ""
"Visitation is prominent in the API provided by concurrent containers, and "
"many classical operations have visitation-enabled variations:"
msgstr ""
"Visitation is prominent in the API provided by concurrent containers, and "
"many classical operations have visitation-enabled variations:"

#: :128
#, read-only, safe-html, strict-same
msgid ""
"Note that in this last example the visitation function could actually "
"_modify_ the element: as a general rule, operations on a concurrent map `m` "
"will grant visitation functions const/non-const access to  the element "
"depending on whether `m` is const/non-const. Const access can be always be "
"explicitly requested by using `cvisit` overloads (for instance, "
"`insert_or_cvisit`) and may result in higher parallelization. For concurrent "
"sets, on the other hand, visitation is always const access."
msgstr ""
"Note that in this last example the visitation function could actually "
"_modify_ the element: as a general rule, operations on a concurrent map `m` "
"will grant visitation functions const/non-const access to  the element "
"depending on whether `m` is const/non-const. Const access can be always be "
"explicitly requested by using `cvisit` overloads (for instance, "
"`insert_or_cvisit`) and may result in higher parallelization. For concurrent "
"sets, on the other hand, visitation is always const access."

#: :136
#, read-only, safe-html, strict-same
msgid ""
"Although expected to be used much less frequently, concurrent containers "
"also provide insertion operations where an element can be visited right "
"after element creation (in addition to the usual visitation when an "
"equivalent element already exists):"
msgstr ""
"Although expected to be used much less frequently, concurrent containers "
"also provide insertion operations where an element can be visited right "
"after element creation (in addition to the usual visitation when an "
"equivalent element already exists):"

#: :152
#, read-only, safe-html, strict-same
msgid ""
"Consult the references of `xref:reference/"
"concurrent_node_set.adoc#concurrent_node_set[boost::concurrent_node_set]`, "
"`xref:reference/"
"concurrent_node_map.adoc#concurrent_node_map[boost::concurrent_node_map]`, "
"`xref:reference/"
"concurrent_flat_set.adoc#concurrent_flat_set[boost::concurrent_flat_set]` "
"and `xref:reference/"
"concurrent_flat_map.adoc#concurrent_flat_map[boost::concurrent_flat_map]` "
"for the complete list of visitation-enabled operations."
msgstr ""
"Consult the references of `xref:reference/"
"concurrent_node_set.adoc#concurrent_node_set[boost::concurrent_node_set]`, "
"`xref:reference/"
"concurrent_node_map.adoc#concurrent_node_map[boost::concurrent_node_map]`, "
"`xref:reference/"
"concurrent_flat_set.adoc#concurrent_flat_set[boost::concurrent_flat_set]` "
"and `xref:reference/"
"concurrent_flat_map.adoc#concurrent_flat_map[boost::concurrent_flat_map]` "
"for the complete list of visitation-enabled operations."

#: :159
#, read-only, safe-html, strict-same
msgid "Whole-Table Visitation"
msgstr "Whole-Table Visitation"

#: :161
#, read-only, safe-html, strict-same
msgid ""
"In the absence of iterators, `visit_all` is provided as an alternative way "
"to process all the elements in the container:"
msgstr ""
"In the absence of iterators, `visit_all` is provided as an alternative way "
"to process all the elements in the container:"

#: :171
#, read-only, safe-html, strict-same
msgid ""
"In C++17 compilers implementing standard parallel algorithms, whole-table "
"visitation can be parallelized:"
msgstr ""
"In C++17 compilers implementing standard parallel algorithms, whole-table "
"visitation can be parallelized:"

#: :181
#, read-only, safe-html, strict-same
msgid "Traversal can be interrupted midway:"
msgstr "Traversal can be interrupted midway:"

#: :202
#, read-only, safe-html, strict-same
msgid "There is one last whole-table visitation operation, `erase_if`:"
msgstr "There is one last whole-table visitation operation, `erase_if`:"

#: :211
#, read-only, safe-html, strict-same
msgid ""
"`visit_while` and `erase_if` can also be parallelized. Note that, in order "
"to increase efficiency, whole-table visitation operations do not block the "
"table during execution: this implies that elements may be inserted, modified "
"or erased by other threads during visitation. It is advisable not to assume "
"too much about the exact global state of a concurrent container at any point "
"in your program."
msgstr ""
"`visit_while` and `erase_if` can also be parallelized. Note that, in order "
"to increase efficiency, whole-table visitation operations do not block the "
"table during execution: this implies that elements may be inserted, modified "
"or erased by other threads during visitation. It is advisable not to assume "
"too much about the exact global state of a concurrent container at any point "
"in your program."

#: :217
#, read-only, safe-html, strict-same
msgid "Bulk visitation"
msgstr "Bulk visitation"

#: :219
#, read-only, safe-html, strict-same
msgid ""
"Suppose you have an `std::array` of keys you want to look up for in a "
"concurrent map:"
msgstr ""
"Suppose you have an `std::array` of keys you want to look up for in a "
"concurrent map:"

#: :230
#, read-only, safe-html, strict-same
msgid "_Bulk visitation_ allows us to pass all the keys in one operation:"
msgstr "_Bulk visitation_ allows us to pass all the keys in one operation:"

#: :237
#, read-only, safe-html, strict-same
msgid ""
"This functionality is not provided for mere syntactic convenience, though: "
"by processing all the keys at once, some internal optimizations can be "
"applied that increase performance over the regular, one-at-a-time case "
"(consult the "
"xref:benchmarks.adoc#benchmarks_boostconcurrent_flatnode_map[benchmarks]). "
"In fact, it may be beneficial to buffer incoming keys so that they can be "
"bulk visited in chunks:"
msgstr ""
"This functionality is not provided for mere syntactic convenience, though: "
"by processing all the keys at once, some internal optimizations can be "
"applied that increase performance over the regular, one-at-a-time case "
"(consult the "
"xref:benchmarks.adoc#benchmarks_boostconcurrent_flatnode_map[benchmarks]). "
"In fact, it may be beneficial to buffer incoming keys so that they can be "
"bulk visited in chunks:"

#: :261
#, read-only, safe-html, strict-same
msgid ""
"There's a latency/throughput tradeoff here: it will take longer for incoming "
"keys to be processed (since they are buffered), but the number of processed "
"keys per second is higher. `bulk_visit_size` is the recommended chunk size —"
"smaller buffers may yield worse performance."
msgstr ""
"There's a latency/throughput tradeoff here: it will take longer for incoming "
"keys to be processed (since they are buffered), but the number of processed "
"keys per second is higher. `bulk_visit_size` is the recommended chunk size —"
"smaller buffers may yield worse performance."

#: :266
#, read-only, safe-html, strict-same
msgid "Blocking Operations"
msgstr "Blocking Operations"

#: :268
#, read-only, safe-html, strict-same
msgid ""
"Concurrent containers can be copied, assigned, cleared and merged just like "
"any other Boost.Unordered container. Unlike most other operations, these are "
"_blocking_, that is, all other threads are prevented from accesing the "
"tables involved while a copy, assignment, clear or merge operation is in "
"progress. Blocking is taken care of automatically by the library and the "
"user need not take any special precaution, but overall performance may be "
"affected."
msgstr ""
"Concurrent containers can be copied, assigned, cleared and merged just like "
"any other Boost.Unordered container. Unlike most other operations, these are "
"_blocking_, that is, all other threads are prevented from accesing the "
"tables involved while a copy, assignment, clear or merge operation is in "
"progress. Blocking is taken care of automatically by the library and the "
"user need not take any special precaution, but overall performance may be "
"affected."

#: :274
#, read-only, safe-html, strict-same
msgid ""
"Another blocking operation is _rehashing_, which happens explicitly via "
"`rehash`/`reserve` or during insertion when the table's load hits `max_load()"
"`. As with non-concurrent containers, reserving space in advance of bulk "
"insertions will generally speed up the process."
msgstr ""
"Another blocking operation is _rehashing_, which happens explicitly via "
"`rehash`/`reserve` or during insertion when the table's load hits `max_load()"
"`. As with non-concurrent containers, reserving space in advance of bulk "
"insertions will generally speed up the process."

#: :278
#, read-only, safe-html, strict-same
msgid "Interoperability with non-concurrent containers"
msgstr "Interoperability with non-concurrent containers"

#: :280
#, read-only, safe-html, strict-same
msgid ""
"As open-addressing and concurrent containers are based on the same internal "
"data structure, they can be efficiently move-constructed from their non-"
"concurrent counterpart, and vice versa."
msgstr ""
"As open-addressing and concurrent containers are based on the same internal "
"data structure, they can be efficiently move-constructed from their non-"
"concurrent counterpart, and vice versa."

#: :286
#, read-only, safe-html, strict-same
msgid "^|`boost::concurrent_node_set` ^|`boost::unordered_node_set`"
msgstr "^|`boost::concurrent_node_set` ^|`boost::unordered_node_set`"

#: :289
#, read-only, safe-html, strict-same
msgid "^|`boost::concurrent_node_map` ^|`boost::unordered_node_map`"
msgstr "^|`boost::concurrent_node_map` ^|`boost::unordered_node_map`"

#: :292
#, read-only, safe-html, strict-same
msgid "^|`boost::concurrent_flat_set` ^|`boost::unordered_flat_set`"
msgstr "^|`boost::concurrent_flat_set` ^|`boost::unordered_flat_set`"

#: :295
#, read-only, safe-html, strict-same
msgid "^|`boost::concurrent_flat_map` ^|`boost::unordered_flat_map`"
msgstr "^|`boost::concurrent_flat_map` ^|`boost::unordered_flat_map`"

#: :300
#, read-only, safe-html, strict-same
msgid ""
"This interoperability comes handy in multistage scenarios where parts of the "
"data processing happen in parallel whereas other steps are non-concurrent "
"(or non-modifying). In the following example, we want to construct a "
"histogram from a huge input vector of words: the population phase can be "
"done in parallel with `boost::concurrent_flat_map` and results then "
"transferred to the final container."
msgstr ""
"This interoperability comes handy in multistage scenarios where parts of the "
"data processing happen in parallel whereas other steps are non-concurrent "
"(or non-modifying). In the following example, we want to construct a "
"histogram from a huge input vector of words: the population phase can be "
"done in parallel with `boost::concurrent_flat_map` and results then "
"transferred to the final container."
