简体   繁体   中英

Gevent wait for jobs to finish (joinall vs wait)

The first documentation's example waits for all spawned jobs to finish with:

gevent.joinall(jobs, timeout=2)

However, joinall is not documented but wait method is:

Wait for objects to become ready or for event loop to finish.

Do both methods have the same functionality and only differ in their implementations?

joinall is documented:

joinall(greenlets, timeout=None, raise_error=False, count=None) Wait for the greenlets to finish.

Parameters:
greenlets – A sequence (supporting len()) of greenlets to wait for. timeout (float) – If given, the maximum number of seconds to wait. Returns: A sequence of the greenlets that finished before the timeout (if any) expired.

As you can see there are differences in functionalities. The biggest one is that wait applies to many things, whereas joinall only applies to greenlets. So the functionalities of joinall are taylored for greenlets.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM