Skip to content

Commit

Permalink
Avoid mutex in Logger#progress.
Browse files Browse the repository at this point in the history
Closes #717
Fixes #731
  • Loading branch information
lsegal committed Mar 22, 2014
1 parent 2a20196 commit 6cfa74e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/yard/logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,15 @@ def progress(msg, nontty_log = :debug)
if defined?(::Encoding)
icon = PROGRESS_INDICATORS[@progress_indicator] + " "
end
print("\e[2K\e[?25l\e[1m#{icon}#{msg}\e[0m\r")
@mutex.synchronize do
print("\e[2K\e[?25l\e[1m#{icon}#{msg}\e[0m\r")
@progress_msg = msg
@progress_indicator += 1
@progress_indicator %= PROGRESS_INDICATORS.size
end
Thread.new do
sleep(0.05)
@mutex.synchronize do
progress(msg + ".", nil) if @progress_msg == msg
end
progress(msg + ".", nil) if @progress_msg == msg
end
end

Expand Down

0 comments on commit 6cfa74e

Please sign in to comment.