【文件属性】:
文件名称:prodcon:Python生产者-消费者包
文件大小:15KB
文件格式:ZIP
更新时间:2021-02-22 07:49:21
Python
产品
使用线程的生产者使用者模式的易于使用的实现
安装
pip install prodcon
用法示例
import random
import time
from queue import Queue
from prodcon import Producer , Consumer
def generate_items ( start , end ):
for i in range ( start , end + 1 ):
if i == end :
# Add poison pill to stop producer and consumers
yield None
# Simulate producing time
time . sleep ( random . random ()
【文件预览】:
prodcon-master
----setup.py(719B)
----.gitignore(44B)
----prodcon()
--------prodcon.py(4KB)
--------__init__.py(120B)
----LICENSE(34KB)
----Readme.md(1KB)