mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvmdbusd: Correct locking for _common_log
Reduce the lock time and include the flush in the lock. Reported by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
This commit is contained in:
parent
d6f8f59239
commit
f7ca470abe
@ -323,16 +323,17 @@ def _format_log_entry(msg):
|
||||
|
||||
|
||||
def _common_log(msg, *attributes):
|
||||
cfg.stdout_lock.acquire()
|
||||
msg = _format_log_entry(msg)
|
||||
|
||||
cfg.stdout_lock.acquire()
|
||||
|
||||
if STDOUT_TTY and attributes:
|
||||
print(color(msg, *attributes))
|
||||
else:
|
||||
print(msg)
|
||||
|
||||
cfg.stdout_lock.release()
|
||||
sys.stdout.flush()
|
||||
cfg.stdout_lock.release()
|
||||
|
||||
|
||||
# Serializes access to stdout to prevent interleaved output
|
||||
|
Loading…
Reference in New Issue
Block a user