请问eurasia能提供gevent的那种针对greenlet的utils类的工具包不

55 views
Skip to first unread message

lee Alexander

unread,
Mar 18, 2013, 1:51:44 AM3/18/13
to eurasi...@googlegroups.com
比如joinall和spwan,在写一些需要启动一大堆协程工作的东西的时候比较方便

--

沈崴

unread,
Mar 25, 2013, 9:53:38 PM3/25/13
to eurasi...@googlegroups.com
在 eurasia 中直接使用 greenlet 来创建协程。

greenlet(func).switch()

eurasia 提供了 idle_switch、timer_switch 等协程调度工具,具体请参考文档:


https://code.google.com/p/eurasia/wiki/eurasia_3_2_userguide#协程调度


唯一需要注意的是 eurasia 约定从协程中切换出去,应总是切换到当前协程的父栈,如:

idle_switch(getcurrent(), getcurrent().parent)

eurasia.apply_ 提供了线程池支持,传统的阻塞式调用可以用线程池完成,见文档:


https://code.google.com/p/eurasia/wiki/eurasia_3_2_userguide#输入输出

On Monday, March 18, 2013 1:51:44 PM UTC+8, Alexander.Lee wrote:
比如joinall和spwan,在写一些需要启动一大堆协程工作的东西的时候比较方便
Reply all
Reply to author
Forward
0 new messages