| 512 | return self._shutdown_get(True) |
| 513 | |
| 514 | def _shutdown_put(self, immediate): |
| 515 | q = self.type2test(2) |
| 516 | results = [] |
| 517 | go = threading.Event() |
| 518 | q.put("Y") |
| 519 | q.put("D") |
| 520 | # queue fulled |
| 521 | |
| 522 | thrds = ( |
| 523 | (self._put_shutdown, (q, "E", go, results)), |
| 524 | (self._put_shutdown, (q, "W", go, results)), |
| 525 | ) |
| 526 | threads = [] |
| 527 | for func, params in thrds: |
| 528 | threads.append(threading.Thread(target=func, args=params)) |
| 529 | threads[-1].start() |
| 530 | q.shutdown() |
| 531 | go.set() |
| 532 | for t in threads: |
| 533 | t.join() |
| 534 | |
| 535 | self.assertEqual(results, [True]*len(thrds)) |
| 536 | |
| 537 | def test_shutdown_put(self): |
| 538 | return self._shutdown_put(False) |