摘要:
#!/usr/bin/env python# -*- coding: utf-8 -*-from threading import Threadfrom Queue import Queueimport timeclass Producer(Thread): def __init__(self,na 阅读全文
posted @ 2017-09-24 15:14
泽锦
阅读(479)
评论(0)
推荐(0)
摘要:
#!/usr/bin/env python# -*- coding: utf-8 -*-import threadingimport timedef customer(cond): t = threading.currentThread() with cond: # wait()方法创建了一个名为w 阅读全文
posted @ 2017-09-24 11:23
泽锦
阅读(648)
评论(0)
推荐(0)
摘要:
#!/usr/bin/env python# -*- coding: utf-8 -*-import threadingimport timevalue = 0lock = threading.Lock()def add(): global value with lock: new_value = 阅读全文
posted @ 2017-09-24 10:59
泽锦
阅读(359)
评论(0)
推荐(0)
摘要:
输出: python t_Semaphore.py 0 acquire sema1 acquire sema2 acquire sema 1 releas sema2 releas sema0 releas sema3 acquire sema4 acquire sema4 releas sema 阅读全文
posted @ 2017-09-24 10:40
泽锦
阅读(747)
评论(0)
推荐(0)

浙公网安备 33010602011771号