0

Is there an equivalent of std::atomic in Python or the only way of having this behavior if by using a lock from threading.Lock()?

Because as I see it, the Look is exactly like std::mutex, so is there anything more similar to std::atomic?

  • 1
    Given that python's integers are arbitrary precision, atomics may not work so well. – EOF Dec 24 '21 at 10:16
  • 2
    The global interpreter lock (GIL) prevents multiple threads from running simultaneously, so there is no need for atomics to synchronize state. – Botje Dec 24 '21 at 10:18
  • @Botje Thank you! I'll look more deeply into this GIL thing –  Dec 24 '21 at 10:59

0 Answers0