Method
wait_for
(self, predicate, timeout=None)
Source from the content-addressed store, hash-verified
| 311 | self.notify(n=sys.maxsize) |
| 312 | |
| 313 | def wait_for(self, predicate, timeout=None): |
| 314 | result = predicate() |
| 315 | if result: |
| 316 | return result |
| 317 | if timeout is not None: |
| 318 | endtime = time.monotonic() + timeout |
| 319 | else: |
| 320 | endtime = None |
| 321 | waittime = None |
| 322 | while not result: |
| 323 | if endtime is not None: |
| 324 | waittime = endtime - time.monotonic() |
| 325 | if waittime <= 0: |
| 326 | break |
| 327 | self.wait(waittime) |
| 328 | result = predicate() |
| 329 | return result |
| 330 | |
| 331 | # |
| 332 | # Event |
Callers
nothing calls this directly
Tested by
no test coverage detected