socketref,再见!高德

https://github.com/adoggie

  C++博客 :: 首页 :: 联系 :: 聚合  :: 管理
  246 Posts :: 4 Stories :: 312 Comments :: 0 Trackbacks

常用链接

留言簿(54)

我参与的团队

搜索

  •  

最新评论

阅读排行榜

评论排行榜

看到 AsyncResult这个类,想到我之前自己写的处理异步返回值的类 

 1 class MutexObject:
 2     def __init__(self):
 3         self.mtx = threading.Condition()
 4         self.d = None
 5         
 6     def waitObject(self,timeout):
 7         d = None
 8         self.mtx.acquire()
 9         if self.d == None:
10             if timeout:
11                 self.mtx.wait(timeout)
12             else:
13                 self.mtx.wait()
14             d = self.d
15             self.d = None
16         self.mtx.release()
17         return d
18         
19     def notify(self,d):
20         self.mtx.acquire()
21         self.d = d
22         self.mtx.notify()
23         self.mtx.release()
posted on 2013-05-14 01:04 放屁阿狗 阅读(454) 评论(0)  编辑 收藏 引用 所属分类: gevent

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理