On this page
multiprocessing.Event
Prev: multiprocessing.current_process | Up: multiprocessing | Next: multiprocessing.freeze_support
Rel: multiprocessing.active_children, multiprocessing.allow_connection_pickling, multiprocessing.Array, multiprocessing.AuthenticationError
Ref: docs.python.org — multiprocessing.Event
Tags: #public #python3 #stdlib #multiprocessing
Import
import multiprocessing
from multiprocessing import Event
Signature & Overview
multiprocessing.Event()
Returns an event object
Usage
import multiprocessing as mp
ev = mp.Event()
assert ev.is_set() is False
ev.set()
assert ev.wait(timeout=1) is True
Gotchas
- Cleanest cross-process stop/ready signal: Pass the
Eventinto child workers and checkstop_ev.is_set()in their loops.
REPL Inspect
from multiprocessing import Event
help(Event)
Linked from
Related notes
- tuts/python3/stdlib_module/multiprocessing/current_process Linked here; links to this page; shared tags: #multiprocessing, #stdlib
- tuts/python3/stdlib_module/multiprocessing/freeze_support Linked here; links to this page; shared tags: #multiprocessing, #stdlib
- tuts/python3/stdlib_module/multiprocessing Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/multiprocessing/active_children Linked here; shared tags: #multiprocessing, #stdlib
- tuts/python3/stdlib_module/multiprocessing/allow_connection_pickling Linked here; shared tags: #multiprocessing, #stdlib
- tuts/python3/stdlib_module/multiprocessing/Array Linked here; shared tags: #multiprocessing, #stdlib
- tuts/python3/stdlib_module/multiprocessing/AuthenticationError Linked here; shared tags: #multiprocessing, #stdlib
- tuts/python3/stdlib_module/multiprocessing/Barrier shared tags: #multiprocessing, #stdlib
- tuts/python3/stdlib_module/multiprocessing/BoundedSemaphore shared tags: #multiprocessing, #stdlib
- tuts/python3/stdlib_module/multiprocessing/BufferTooShort shared tags: #multiprocessing, #stdlib