From 98a78031810000535189500b207bfadd2e6fd5a3 Mon Sep 17 00:00:00 2001 From: Piotr Murach Date: Fri, 8 Sep 2017 20:10:06 +0200 Subject: [PATCH] Change to simulate contention --- examples/multi/main_bar.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/multi/main_bar.rb b/examples/multi/main_bar.rb index 6489d89..f4f9796 100644 --- a/examples/multi/main_bar.rb +++ b/examples/multi/main_bar.rb @@ -4,14 +4,14 @@ bars = TTY::ProgressBar::Multi.new("main [:bar] :percent") -bar1 = bars.register "foo [:bar] :percent", total: 20 -bar2 = bars.register "bar [:bar] :percent", total: 30 -bar3 = bars.register "baz [:bar] :percent", total: 10 +bar1 = bars.register "foo [:bar] :percent", total: 15 +bar2 = bars.register "bar [:bar] :percent", total: 15 +bar3 = bars.register "baz [:bar] :percent", total: 45 bars.start -th1 = Thread.new { 20.times { sleep(0.2); bar1.advance } } -th2 = Thread.new { 30.times { sleep(0.1); bar2.advance } } -th3 = Thread.new { 10.times { sleep(0.3); bar3.advance } } +th1 = Thread.new { 15.times { sleep(0.1); bar1.advance } } +th2 = Thread.new { 15.times { sleep(0.1); bar2.advance } } +th3 = Thread.new { 45.times { sleep(0.1); bar3.advance } } [th1, th2, th3].each(&:join)