Skip to content

Commit

Permalink
docs: Reword last bullet point of thread safety guarantees
Browse files Browse the repository at this point in the history
This was worded somewhat confusingly; we should be explicit that it's
okay to access multiple documents concurrently as long as access to each
one is serialized.
  • Loading branch information
zeux committed Nov 5, 2024
1 parent 3480faa commit f1f532a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/manual.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,9 @@ Almost all functions in pugixml have the following thread-safety guarantees:

* it is safe to call free (non-member) functions from multiple threads
* it is safe to perform concurrent read-only accesses to the same tree (all constant member functions do not modify the tree)
* it is safe to perform concurrent read/write accesses, if there is only one read or write access to the single tree at a time
* it is safe to perform concurrent read/write accesses on multiple trees, as long as each tree is only accessed from a single thread at a time

Concurrent modification and traversing of a single tree requires synchronization, for example via reader-writer lock. Modification includes altering document structure and altering individual node/attribute data, i.e. changing names/values.
Concurrent read/write access to a single tree requires synchronization, for example via a reader-writer lock. Modification includes altering document structure and altering individual node/attribute data, i.e. changing names/values.

The only exception is <<set_memory_management_functions,set_memory_management_functions>>; it modifies global variables and as such is not thread-safe. Its usage policy has more restrictions, see <<dom.memory.custom>>.

Expand Down
6 changes: 3 additions & 3 deletions docs/manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -1356,12 +1356,12 @@ <h3 id="dom.thread"><a class="anchor" href="#dom.thread"></a><a class="link" hre
<p>it is safe to perform concurrent read-only accesses to the same tree (all constant member functions do not modify the tree)</p>
</li>
<li>
<p>it is safe to perform concurrent read/write accesses, if there is only one read or write access to the single tree at a time</p>
<p>it is safe to perform concurrent read/write accesses on multiple trees, as long as each tree is only accessed from a single thread at a time</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Concurrent modification and traversing of a single tree requires synchronization, for example via reader-writer lock. Modification includes altering document structure and altering individual node/attribute data, i.e. changing names/values.</p>
<p>Concurrent read/write access to a single tree requires synchronization, for example via a reader-writer lock. Modification includes altering document structure and altering individual node/attribute data, i.e. changing names/values.</p>
</div>
<div class="paragraph">
<p>The only exception is <a href="#set_memory_management_functions">set_memory_management_functions</a>; it modifies global variables and as such is not thread-safe. Its usage policy has more restrictions, see <a href="#dom.memory.custom">Custom memory allocation/deallocation functions</a>.</p>
Expand Down Expand Up @@ -6216,7 +6216,7 @@ <h3 id="apiref.functions"><a class="anchor" href="#apiref.functions"></a><a clas
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-10-30 10:34:38 -0700
Last updated 2024-11-05 07:43:48 -0800
</div>
</div>
</body>
Expand Down

0 comments on commit f1f532a

Please sign in to comment.