Fernando Rodríguez wrote:
[color=blue]
> Is the standard output thread-safe? Can I use print from several threads
> without having to use a mutex?[/color]
if you use sys.stdout.writ e 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.
Hello Fredrik,
[color=blue]
> Fernando Rodríguez wrote:
>[color=green]
>> Is the standard output thread-safe? Can I use print from several
>> threads without having to use a mutex?
>>[/color]
> if you use sys.stdout.writ e on the standard sys.stdout stream, each
> write operation is "atomic" (thanks to the GIL).[/color]
Em Qui, 2006-03-09 Ã s 16:37 +0000, Fernando RodrÃguez escreveu:[color=blue]
> Hello Fredrik,
>[color=green]
> > Fernando RodrÃguez wrote:
> >[color=darkred]
> >> Is the standard output thread-safe? Can I use print from several
> >> threads without having to use a mutex?
> >>[/color]
> > if you use sys.stdout.writ e on the standard sys.stdout stream, each
> > write operation is "atomic" (thanks to the GIL).[/color]
>
> GIL?
>[/color]
Fernando Rodríguez <frr@easyjob.ne t> writes:
[color=blue]
> Hi,
>
> Is the standard output thread-safe? Can I use print from several
> threads without having to use a mutex?
>
> Thanks
>
>[/color]
Comment