
Код: Выделить всё
FileNotFoundErrorКод: Выделить всё
def main():
# Use a context manager to manage
#the process pool
try:
with concurrent.futures.
ProcessPoolExecutor() as
executor:
for _ in range(100):
# Produce and Consume
executor.submit(
producer.
more_care_bear())
executor.submit(
consumer.
get_care_bear())
executor.shutdown(True)
except FileNotFoundError
as file_error:
pass
if __name__ == "__main__":
# Required for multiprocessing
# to work correctly on many
# systems
prod_queue = Product_Queue()
producer =
Care_Bear_Products(prod_queue)
consumer =
Care_Bear_Consumption(
prod_queue)
main()
Код: Выделить всё
try:
nsems_max =
os.sysconf("SC_SEM_NSEMS_MAX")
except (AttributeError,
ValueError):
# sysconf not available or
# setting not available
return
if nsems_max == -1:
# indetermined limit, assume that limit is determined
# by available memory only
return
if nsems_max >= 256:
# minimum number of semaphores available
# according to POSIX
return
Я просмотрел Google, и все рекомендации ссылаются на работу файловой системы, которую мой код не делает, кроме как через дескрипторы файлов, которые внутренний для параллелизма в Python. На снимке экрана показан файлprocess.py как часть отчета об ошибках, а мой код определен с помощью def main().
Подробнее здесь: https://stackoverflow.com/questions/798 ... sing-proce
Мобильная версия