| 319 | return self._shutdown_all_methods_in_one_thread(True) |
| 320 | |
| 321 | def _write_msg_thread(self, q, n, results, |
| 322 | i_when_exec_shutdown, event_shutdown, |
| 323 | barrier_start): |
| 324 | # All `write_msg_threads` |
| 325 | # put several items into the queue. |
| 326 | for i in range(0, i_when_exec_shutdown//2): |
| 327 | q.put((i, 'LOYD')) |
| 328 | # Wait for the barrier to be complete. |
| 329 | barrier_start.wait() |
| 330 | |
| 331 | for i in range(i_when_exec_shutdown//2, n): |
| 332 | try: |
| 333 | q.put((i, "YDLO")) |
| 334 | except self.queue.ShutDown: |
| 335 | results.append(False) |
| 336 | break |
| 337 | |
| 338 | # Trigger queue shutdown. |
| 339 | if i == i_when_exec_shutdown: |
| 340 | # Only one thread should call shutdown(). |
| 341 | if not event_shutdown.is_set(): |
| 342 | event_shutdown.set() |
| 343 | results.append(True) |
| 344 | |
| 345 | def _read_msg_thread(self, q, results, barrier_start): |
| 346 | # Get at least one item. |