Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76099
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Marko Rauhamaa <marko@pacujo.net> |
| Newsgroups | comp.lang.python |
| Subject | Re: Is print thread safe? |
| Date | Tue, 12 Aug 2014 08:01:39 +0300 |
| Organization | A noiseless patient Spider |
| Lines | 19 |
| Message-ID | <87k36ee1xo.fsf@elektro.pacujo.net> (permalink) |
| References | <53e8ea27$0$29981$c3e8da3$5496439d@news.astraweb.com> <mailman.12868.1407795799.18130.python-list@python.org> <53e9583b$0$29973$c3e8da3$5496439d@news.astraweb.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Injection-Info | mx05.eternal-september.org; posting-host="ff5cf27ef3d5b31f034d3b72bdc27a41"; logging-data="3507"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/vEgGxrZTTEgJDR6fhlwqt" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
| Cancel-Lock | sha1:bHkWGn7WROBXTD/0wUmfCjoVcS0= sha1:TkeQybhV5QeOCKVS/Cq7ZgcWP/o= |
| Xref | csiph.com comp.lang.python:76099 |
Show key headers only | View raw
Steven D'Aprano <steve+comp.lang.python@pearwood.info>: > Personally, I believe that print ought to do its own locking. And > print is a statement, although in this case there's no need to support > anything older than 2.6, so something like this ought to work: > > > from __future__ import print_function > > _print = print > _rlock = threading.RLock() > def print(*args, **kwargs): > with _rlock: > _print(*args, **kwargs) Could this cause a deadlock if print were used in signal handlers? Marko
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is print thread safe? Steven D'Aprano <steve@pearwood.info> - 2014-08-11 07:44 +0000
Re: Is print thread safe? INADA Naoki <songofacandy@gmail.com> - 2014-08-11 19:19 +0900
Re: Is print thread safe? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-12 02:07 +1000
Re: Is print thread safe? Cameron Simpson <cs@zip.com.au> - 2014-08-12 07:53 +1000
Re: Is print thread safe? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-12 09:56 +1000
Re: Is print thread safe? Chris Angelico <rosuav@gmail.com> - 2014-08-12 10:14 +1000
Re: Is print thread safe? Marko Rauhamaa <marko@pacujo.net> - 2014-08-12 08:01 +0300
Re: Is print thread safe? Cameron Simpson <cs@zip.com.au> - 2014-08-12 16:15 +1000
Re: Is print thread safe? Cameron Simpson <cs@zip.com.au> - 2014-08-12 14:31 +1000
Re: Is print thread safe? Chris Angelico <rosuav@gmail.com> - 2014-08-12 23:53 +1000
csiph-web