[Lldb-commits] [PATCH] D100418: [lldb] [MainLoop] Support multiple callbacks per signal

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 14 11:42:47 PDT 2021


mgorny added a comment.

In D100418#2689348 <https://reviews.llvm.org/D100418#2689348>, @labath wrote:

> I've been thinking about whether this should be done here, or via a separate multiplexer entity. It's not clear to me which one is cleaner so I suppose we can go with what you have done here.
>
> That said, I'm not too happy about this callback_id business. IIUC, it's only there to enable removing a specific callback (because you can't have a set of std::functions). But there are other ways to achieve that, and they don't leak this detail to the users. One option would be to hold the callbacks in a std::list, and use the (stable) iterator as the ID....
>
> It could also use a test... something like, register a callback, fire a signal and check it's called, registers a second callback and check that both are called, unregister the first one and check that only the second one is called, ...

Hmm, my first though was to use a `static int` that increases with every call. But the `std::list` idea is interesting, so I'll explore that.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100418/new/

https://reviews.llvm.org/D100418



More information about the lldb-commits mailing list