>
>
>
>
>
>
>
>
>
> > On Tue, May 15, 2012 at 11:33 PM, Tarek Ziadé <
ziade.ta...@gmail.com> wrote:
> >> So I was wondering: how can I enumerate all "active" frames in order
> >> to print their stacks like I would do with threads ? If this feature
> >> does not exists, how hard would it be to add a registry to track all
> >> greenlets ?
>
> > I don't think threading.enumerate() is supposed to work with
> > greenlets. It only enumerates Thread() objects. It does not even work
> > with threads created by other means, e.g. thread.start_new_thread.
>
> > There won't be a registry of all greenlets in gevent as that will come
> > with overhead.
>
> > Maybe it could be possible to modify greenlet to enumerate greenlets,
> > perhaps it's worth looking into exposing stack_prev member
> > (
https://github.com/python-greenlet/greenlet/blob/master/greenlet.h#L21)
>
> I just remembered that Alexey Borzenkov has recently been working on a
> tracing callback for debugging purposes of greenlets:
https://github.com/python-greenlet/greenlet/issues/5 There is even a
> branch with working code. I don't think it's very hard to write such
> a callback which keeps track of all greenlets in a thread-local dict,
> which would give you what you need.
>