Fix TimerTask docs to not refer to #execute as "blocking"#996
Merged
ioquatix merged 1 commit intoruby-concurrency:masterfrom Jul 5, 2023
Merged
Fix TimerTask docs to not refer to #execute as "blocking"#996ioquatix merged 1 commit intoruby-concurrency:masterfrom
#execute as "blocking"#996ioquatix merged 1 commit intoruby-concurrency:masterfrom
Conversation
Also fixes some small other oddities I found when running the code example
ioquatix
approved these changes
Jul 5, 2023
ioquatix
reviewed
Jul 5, 2023
| # #=> Boom! Boom! | ||
| # #=> Boom! Boom! Boom! | ||
| # #=> Boom! Boom! Boom! Boom! | ||
| # #=> Boom! Boom! Boom! Boom! Boom! |
Contributor
There was a problem hiding this comment.
Can you double check this removal is correct?
When I ran the code, I got:
Boom!
Boom! Boom!
Boom! Boom! Boom!
Boom! Boom! Boom! Boom!
Boom! Boom! Boom! Boom! Boom!
Stopping...
Contributor
Author
There was a problem hiding this comment.
Oops, sorry about that. I just re-ran it myself and also got 5 booms. I'll make a correction 🤦🏻
❯ bundle exec irb
Ignoring concurrent-ruby-ext-1.2.2 because its extensions are not built. Try: gem pristine concurrent-ruby-ext --version 1.2.2
irb(main):001:0> require 'concurrent/timer_task'
=> true
irb(main):002:1* timer_task = Concurrent::TimerTask.new(execution_interval: 1) do |task|
irb(main):003:1* task.execution_interval.to_i.times{ print 'Boom! ' }
irb(main):004:1* print "\n"
irb(main):005:1* task.execution_interval += 1
irb(main):006:2* if task.execution_interval > 5
irb(main):007:2* puts 'Stopping...'
irb(main):008:2* task.shutdown
irb(main):009:1* end
irb(main):010:0> end
=>
#<Concurrent::TimerTask:0x0000000105b49d48
...
irb(main):011:0>
irb(main):012:0> timer_task.execute
=>
#<Concurrent::TimerTask:0x0000000105b49d48
@StopEvent=
#<Concurrent::Event:0x0000000105b49ca8
@__Condition__=#<Thread::ConditionVariable:0x00000001058d1160>,
@__Lock__=#<Thread::Mutex:0x00000001058d1188>,
@iteration=0,
@set=false>,
@StoppedEvent=
#<Concurrent::Event:0x0000000105b49c58
@__Condition__=#<Thread::ConditionVariable:0x00000001058d10c0>,
@__Lock__=#<Thread::Mutex:0x00000001058d10e8>,
@iteration=0,
@set=false>,
@__Condition__=#<Thread::ConditionVariable:0x00000001058d2178>,
@__Lock__=#<Thread::Mutex:0x00000001058d21a0>,
@auto_terminate=true,
@copy_on_deref=nil,
@do_nothing_on_deref=true,
@dup_on_deref=nil,
@execution_interval=1.0,
@executor=
#<Concurrent::SafeTaskExecutor:0x0000000105b49cf8
@__Condition__=#<Thread::ConditionVariable:0x00000001058d1958>,
@__Lock__=#<Thread::Mutex:0x00000001058d1980>,
@exception_class=StandardError,
@task=#<Proc:0x00000001058d1ef8 (irb):2>>,
@freeze_on_deref=nil,
@observers=
#<Concurrent::Collection::CopyOnNotifyObserverSet:0x00000001058d14d0
@__Condition__=#<Thread::ConditionVariable:0x00000001058d1340>,
@__Lock__=#<Thread::Mutex:0x00000001058d1368>,
@observers={}>,
@run_now=nil,
@running=#<Concurrent::AtomicBoolean:0x00000001058d1638 value:true>,
@value=nil>
irb(main):013:0> Boom!
Boom! Boom!
Boom! Boom! Boom!
Boom! Boom! Boom! Boom!
Boom! Boom! Boom! Boom! Boom!
Stopping...
irb(main):013:0>
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also fixes some small other oddities I found when running the code example.
Closes #794