Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dougeverly/delayedthread
DelayedThread constructs threads with delayed execution.
https://github.com/dougeverly/delayedthread
Last synced: about 1 month ago
JSON representation
DelayedThread constructs threads with delayed execution.
- Host: GitHub
- URL: https://github.com/dougeverly/delayedthread
- Owner: DougEverly
- Created: 2013-07-03T23:49:46.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-07-04T13:49:27.000Z (over 11 years ago)
- Last Synced: 2023-03-11T20:48:09.676Z (almost 2 years ago)
- Language: Ruby
- Size: 105 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
DelayedThread
=============DelayedThread constructs threads with delayed execution.
Usage
-----```ruby
d = DelayedThread.new
# Add a delayed thread
d.delayed_thread do
5.times do |x|
puts x.to_s
sleep 1
end
end# Add another delayed thread
d.delayed_thread do
5.times do |x|
puts (x * 2).to_s
sleep 1
end
end# wait some time
sleep 2
# start delayed thread execution
d.start
# join delayed threads
d.join
```
Do not delay threads
```ruby
d.delayed = false
```
Get list of delayed threads```ruby
d.threads # => Array
```