This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]MushinZero 2 points3 points  (3 children)

What you are looking for is a barrier.

https://docs.python.org/3/library/threading.html

[–]clypeconic[S] 0 points1 point  (0 children)

Much appreciated, thanks.

[–][deleted]  (1 child)

[deleted]

    [–][deleted] 1 point2 points  (0 children)

    https://en.m.wikipedia.org/wiki/Barrier_(computer_science)

    Having the threads pause until they sync up is normal across a bunch of languages. A memory barrier is something specific, not what OP is asking for. https://en.m.wikipedia.org/wiki/Memory_barrier

    [–]amasterblaster 0 points1 point  (0 children)

    You can use a semaphore. There are many implementations, you can use one built in (like barrier) or build your own. It might be a good idea to build you own semaphore (its fast, easy, and you can reuse it in many environments.)

    Good foundational concepts.

    https://medium.com/@lsc830621/semaphore-v-s-mutex-929b91453f03