MichaelMichael gevent

一些关于gevent module的常见用法

Greenlet objects

Greenlet is a light-weight cooperatively-scheduled execution unit. pass the target function and its arguments to Greenlet constructor and call start():

g = Greenlet(myfunction, 'arg1', 'arg2', kwarg1=1)
g.start()
g = Greenlet.spawn(myfunction, 'arg1', 'arg2', kwarg1=1) # the other     way to create and run greenlet

class Greenlet

Greenlet.init(run=None, args, *kwargs)

Greenlet constructor.
Parameters:    
    args – The arguments passed to the run function.
    kwargs – The keyword arguments passed to the run function.
    run – The callable object to run. If not given, this object’s _run method will be invoked (typically defined by subclasses).

参考

http://www.gevent.org/