On this page
multiprocessing.BoundedSemaphore
Prev: multiprocessing.Barrier | Up: multiprocessing | Next: multiprocessing.BufferTooShort
Rel: multiprocessing.active_children, multiprocessing.allow_connection_pickling, multiprocessing.Array, multiprocessing.AuthenticationError
Ref: docs.python.org — multiprocessing.BoundedSemaphore
Tags: #public #python3 #stdlib #multiprocessing
Import
import multiprocessing
from multiprocessing import BoundedSemaphore
Signature & Overview
multiprocessing.BoundedSemaphore(value=1)
Returns a bounded semaphore object
Usage
import multiprocessing as mp
sem = mp.BoundedSemaphore(2)
with sem:
assert True
Gotchas
- Process-safe
BoundedSemaphore: RaisesValueErrorif.release()exceeds the initial value.
REPL Inspect
from multiprocessing import BoundedSemaphore
help(BoundedSemaphore)
Linked from
Related notes
- tuts/python3/stdlib_module/multiprocessing/Barrier Linked here; links to this page; shared tags: #multiprocessing, #stdlib
- tuts/python3/stdlib_module/multiprocessing/BufferTooShort 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/Condition shared tags: #multiprocessing, #stdlib
- tuts/python3/stdlib_module/multiprocessing/cpu_count shared tags: #multiprocessing, #stdlib
- tuts/python3/stdlib_module/multiprocessing/current_process shared tags: #multiprocessing, #stdlib