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