def green_pool_wait_all(pool):
    """
    Wait for all the green threads in the pool to finish.
    """
    if CONCURRENCY_LIBRARY == "eventlet":
        return pool.waitall()
    elif CONCURRENCY_LIBRARY == "gevent":
        # NOTE: This mimicks eventlet.waitall() functionallity better than
        # pool.join()
        return all(gl.ready() for gl in pool.greenlets)
    else:
        raise ValueError("Unsupported concurrency library")

    Wait for all the green threads in the pool to finish.
    
st2common/st2common/util/concurrency.py