Function
thread_run
(cpu, in_queue, out_queue)
Source from the content-addressed store, hash-verified
| 369 | |
| 370 | |
| 371 | def thread_run(cpu, in_queue, out_queue): |
| 372 | if cpu is not None and hasattr(os, "sched_setaffinity"): |
| 373 | # Set the affinity for the current thread |
| 374 | os.sched_setaffinity(0, (cpu,)) |
| 375 | |
| 376 | while True: |
| 377 | func = in_queue.get() |
| 378 | if func is None: |
| 379 | break |
| 380 | func() |
| 381 | out_queue.put(None) |
| 382 | |
| 383 | |
| 384 | def initialize_threads(opts): |
Used in the wild real call sites across dependent graphs
searching dependent graphs…