Block until the internal flag is true. If the internal flag is true on entry, return immediately. Otherwise, block until another thread calls set() to set the flag to true, or until the optional timeout occurs. When the timeout argument is present and not None, it s
(self, timeout=None)
| 642 | self._flag = False |
| 643 | |
| 644 | def wait(self, timeout=None): |
| 645 | """Block until the internal flag is true. |
| 646 | |
| 647 | If the internal flag is true on entry, return immediately. Otherwise, |
| 648 | block until another thread calls set() to set the flag to true, or until |
| 649 | the optional timeout occurs. |
| 650 | |
| 651 | When the timeout argument is present and not None, it should be a |
| 652 | floating-point number specifying a timeout for the operation in seconds |
| 653 | (or fractions thereof). |
| 654 | |
| 655 | This method returns the internal flag on exit, so it will always return |
| 656 | ``True`` except if a timeout is given and the operation times out, when |
| 657 | it will return ``False``. |
| 658 | |
| 659 | """ |
| 660 | with self._cond: |
| 661 | signaled = self._flag |
| 662 | if not signaled: |
| 663 | signaled = self._cond.wait(timeout) |
| 664 | return signaled |
| 665 | |
| 666 | |
| 667 | # A barrier class. Inspired in part by the pthread_barrier_* api and |
no outgoing calls
no test coverage detected