Skip to content

Instantly share code, notes, and snippets.

@kemingy
Created July 13, 2020 03:58
Show Gist options
  • Save kemingy/27939aed551621ed88230668eea151d5 to your computer and use it in GitHub Desktop.
Save kemingy/27939aed551621ed88230668eea151d5 to your computer and use it in GitHub Desktop.
Python multithread/multiprocessing object
  • Lock
  • RLock: a reentrant lock
  • Condition:
    • wait: release the lock
    • notify/notify_all
  • Semaphore: manages an internal counter (always non-negative)
  • Event: manages an internal flag (boolean)
  • Timer
  • Barrier: a fixed number of threads that need to wait for each other
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment