multitask multitask allows Python programs to use generators (aka coroutines) to perform cooperative multitasking and asynchronous I/O. Applications written using multitask consist of a set of cooperating tasks that yield to a shared task manager whenever they perform a (potentially) blocking operation, such as I/O on a socket or getting data from a queue. The task manager temporarily suspends the task (allowing other tasks to run in the meantime) and then restarts it when the blocking operation is complete. Such an approach is suitable for applications that would otherwise have to use select() and/or multiple threads to achieve concurrency. Producer/Consumer with multitask library Hive This is a basic concurrency module that uses only dependencies available in the Python 2.5 standard library. It allows the creation of a jobfile for uses to queue work that any number of worker processes with access to the jobfile can pull from the queue and run. 看到这两个库很快就联想到曾经写过的那段代码,python2.5 增强的 yield 表达式所蕴涵的 continuation 的能力似乎终于有人拿它来发挥点实际作用了。
2007年5月30日星期三
订阅:
博文评论 (Atom)
Profile
- 黄毅
- 深圳, 广州, China
- I Love Python !
Recent Posts
Recent Comments
Tags
- 设计模式 (1)
- ajax (3)
- allegra (1)
- cherrypy (1)
- compiler (1)
- continuation (2)
- descriptor (1)
- django (17)
- dotnet (1)
- framework (2)
- functional (1)
- genshi (1)
- gtk (1)
- haskell (1)
- inkscape (1)
- IronPython (2)
- javascript (1)
- libevent (1)
- mako (1)
- metaclass (4)
- mochikit (1)
- network (1)
- newforms (1)
- orm (1)
- others (18)
- paste (1)
- PEAK (1)
- pickle (1)
- ply (1)
- pocoo (1)
- pypy (3)
- python (38)
- python3000 (3)
- rails (2)
- REST (3)
- sqlalchemy (3)
- stackless (3)
- turbogears (1)
- tutorial (1)
- vim (1)
- web (11)
- wsgi (1)
0 评论:
发表评论