Should I acquire lock for logging.Handler.flush()?

Fayaz Yusuf Khan fayaz.yusuf.khan at gmail.com
Thu Feb 23 12:55:07 EST 2012


On Thursday 23 Feb 2012 8:23:42 AM Vinay Sajip wrote:
> If locking is required in a particular handler class for close or
> flush, that can be implemented by the developer of that handler class.
> AFAIK there is no such need for the handler classes in the stdlib - if
> you have reason to believe otherwise, please give some examples of
> potential problems and with example code if possible.
Well, I'm not currently facing any race-around conditions. As I said, I was 
mostly familiarizing myself with the API.
Well, as emit() is always being called from within a lock, I assumed that 
flush() should/would also be handled similarly. Afterall, they are handling the 
same underlying output stream or in case of the BufferingHandler share the same 
buffer. Shouldn't the access be synchronized?
-- 
Fayaz Yusuf Khan
Cloud developer and architect
Dexetra SS, Bangalore, India
fayaz.yusuf.khan_AT_gmail_DOT_com
fayaz_AT_dexetra_DOT_com
+91-9746-830-823
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.python.org/pipermail/python-list/attachments/20120223/327d6a71/attachment-0001.sig>


More information about the Python-list mailing list