队列,生产者消费者模型,协程,异步IO

Alex本期相关博文

Python中的Priority Queue是minimal priority queue.

Queue使用task_done与join实现生产者与消费者的通信。

Queue只能用于一个进程的各个线程的同步。

from urllib.request import urlopen

from gevent import monkey

mokey.patch_all() #去除package中的阻塞

从gevent中import进来的socket无需使用monkey来去除阻塞,但直接import socket则需要。