(self)
| 1655 | join_process(p) |
| 1656 | |
| 1657 | def test_notify_all(self): |
| 1658 | cond = self.Condition() |
| 1659 | sleeping = self.Semaphore(0) |
| 1660 | woken = self.Semaphore(0) |
| 1661 | |
| 1662 | # start some threads/processes which will timeout |
| 1663 | workers = [] |
| 1664 | for i in range(3): |
| 1665 | p = self.Process(target=self.f, |
| 1666 | args=(cond, sleeping, woken, TIMEOUT1)) |
| 1667 | p.daemon = True |
| 1668 | p.start() |
| 1669 | workers.append(p) |
| 1670 | |
| 1671 | t = threading.Thread(target=self.f, |
| 1672 | args=(cond, sleeping, woken, TIMEOUT1)) |
| 1673 | t.daemon = True |
| 1674 | t.start() |
| 1675 | workers.append(t) |
| 1676 | |
| 1677 | # wait for them all to sleep |
| 1678 | for i in range(6): |
| 1679 | sleeping.acquire() |
| 1680 | |
| 1681 | # check they have all timed out |
| 1682 | for i in range(6): |
| 1683 | woken.acquire() |
| 1684 | self.assertReturnsIfImplemented(0, get_value, woken) |
| 1685 | |
| 1686 | # check state is not mucked up |
| 1687 | self.check_invariant(cond) |
| 1688 | |
| 1689 | # start some more threads/processes |
| 1690 | for i in range(3): |
| 1691 | p = self.Process(target=self.f, args=(cond, sleeping, woken)) |
| 1692 | p.daemon = True |
| 1693 | p.start() |
| 1694 | workers.append(p) |
| 1695 | |
| 1696 | t = threading.Thread(target=self.f, args=(cond, sleeping, woken)) |
| 1697 | t.daemon = True |
| 1698 | t.start() |
| 1699 | workers.append(t) |
| 1700 | |
| 1701 | # wait for them to all sleep |
| 1702 | for i in range(6): |
| 1703 | sleeping.acquire() |
| 1704 | |
| 1705 | # check no process/thread has woken up |
| 1706 | time.sleep(DELTA) |
| 1707 | self.assertReturnsIfImplemented(0, get_value, woken) |
| 1708 | |
| 1709 | # wake them all up |
| 1710 | cond.acquire() |
| 1711 | cond.notify_all() |
| 1712 | cond.release() |
| 1713 | |
| 1714 | # check they have all woken |
nothing calls this directly
no test coverage detected