================ @@ -380,6 +380,18 @@ def wait_for_event(self, filter=None, timeout=None): ) return None + def wait_for_events(self, events, timeout=None): + """Wait for a list of events in `events` in any order. + Return the events not hit before the timeout expired""" + events = events[:] # Make a copy to avoid modifying the input + end_time = time.time() + timeout if timeout else None + while events and (not end_time or end_time > time.time()): + event_dict = self.wait_for_event(filter=events, timeout=timeout) + if not event_dict: + continue + events.remove(event_dict["event"]) ---------------- dmpots wrote:
@JDevlieghere I think its not quite the same because it is allowing a timeout per-event instead of a "global" timeout for all the events. So we could end up with around `len(events)*timeout` of total time if each event is triggered just before the timeout expires. In @kusmour version it would be bounder closer to `2 * timeout` if the first event is triggered just before the timeout expires. I think having the timeout be per-event and not global is reasonable and simplifies the code a bit. https://github.com/llvm/llvm-project/pull/137278 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits