Issue #9945: logging: Fixed locking bugs in addHandler/removeHandler.
This commit is contained in:
parent
7db964d5aa
commit
546885ea4e
|
@ -1263,20 +1263,23 @@ class Logger(Filterer):
|
|||
"""
|
||||
Add the specified handler to this logger.
|
||||
"""
|
||||
if not (hdlr in self.handlers):
|
||||
self.handlers.append(hdlr)
|
||||
_acquireLock()
|
||||
try:
|
||||
if not (hdlr in self.handlers):
|
||||
self.handlers.append(hdlr)
|
||||
finally:
|
||||
_releaseLock()
|
||||
|
||||
def removeHandler(self, hdlr):
|
||||
"""
|
||||
Remove the specified handler from this logger.
|
||||
"""
|
||||
if hdlr in self.handlers:
|
||||
#hdlr.close()
|
||||
hdlr.acquire()
|
||||
try:
|
||||
_acquireLock()
|
||||
try:
|
||||
if hdlr in self.handlers:
|
||||
self.handlers.remove(hdlr)
|
||||
finally:
|
||||
hdlr.release()
|
||||
finally:
|
||||
_releaseLock()
|
||||
|
||||
def callHandlers(self, record):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue