Skip to content
Prev Previous commit
Next Next commit
Use correct ref for atomic
  • Loading branch information
lysnikolaou committed Dec 18, 2025
commit 11e807236914b63b54b5bf6f24a58a95363ead77
6 changes: 3 additions & 3 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,7 @@ application).
threads and will not corrupt the list.
Comment on lines +1466 to +1467
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is safe in the sense that it won't corrupt the list, but should we also mention that it results in a race condition?


The following operations return new objects and appear
:term:`atomic <atomic operations>` to other threads:
:term:`atomic <atomic operation>` to other threads:

.. code-block::
:class: good
Expand All @@ -1477,15 +1477,15 @@ application).
lst.copy() # returns a shallow copy of the list

Methods that only operate on a single elements with no shifting required are
:term:`atomic <atomic operations>`:
:term:`atomic <atomic operation>`:

.. code-block::
:class: good

lst.append(x) # append to the end of the list, no shifting required
lst.pop() # pop element from the end of the list, no shifting required

The :meth:`~list.clear` method is also :term:`atomic <atomic operations>`.
The :meth:`~list.clear` method is also :term:`atomic <atomic operation>`.
Other threads cannot observe elements being removed.

The :meth:`~list.sort` method is not :term:`atomic <atomic operation>`.
Expand Down