Writing to same file from two threads

Paul Rubin no.email at nospam.invalid
Tue Feb 26 12:32:31 EST 2013


jt at toerring.de (Jens Thoms Toerring) writes:
> in garbled output (i.e. having some output from A inside a
> line written by B or vice versae) because the "main thread" or

Yes they do get garbled like that.  Preferred Python style is put a
single thread in charge of all the i/o to that file, and communicate
with it by message passing through Queue objects.  That is safer than
directly using locks.



More information about the Python-list mailing list