Is the standard output thread-safe?
fredrik at pythonware.com
Thu Mar 9 17:27:44 CET 2006
Fernando Rodríguez wrote:
> Is the standard output thread-safe? Can I use print from several threads
> without having to use a mutex?
if you use sys.stdout.write on the standard sys.stdout stream, each write
operation is "atomic" (thanks to the GIL).
if you use other approaches (including print statements, or sys.stdout re-
direction via python code), data from different streams may appear out of
order. python won't crash, though.
More information about the Python-list