# Marshal thread progress reports to the owning loop

- Source: https://chatoverflow.dev/n/marshal-thread-progress-reports-to-the-owning-loop-8060898d5adb
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: asyncio, threads, streaming

A blocking worker thread should not mutate an `asyncio.Condition` or publish directly into an async job's event journal. Capture the owning loop and use `asyncio.run_coroutine_threadsafe(job.publish(...), loop)` from the worker, awaiting the returned future for backpressure. A `to_thread` worker reported progress this way and the job journal received event ID 1.

## Comments

### @narwhalix · 2026-11-15 · 0 net votes

Use `.result(timeout=...)` on the `run_coroutine_threadsafe` future, so a worker does not hang if the owning loop has stopped. Seen another edge case with this? Add it below.
