Class: Contender::SimpleThreadFactory
- Inherits:
-
ThreadFactory
- Object
- ThreadFactory
- Contender::SimpleThreadFactory
- Defined in:
- lib/contender/thread_factory.rb
Instance Attribute Summary collapse
- #group ⇒ ThreadGroup readonly
- #priority ⇒ Integer
Instance Method Summary collapse
- #create { ... } ⇒ Thread
- #initialize ⇒ undefined constructor
Constructor Details
#initialize ⇒ undefined
20 21 22 23 |
# File 'lib/contender/thread_factory.rb', line 20 def initialize @group = ThreadGroup.new @priority = 0 end |
Instance Attribute Details
#group ⇒ ThreadGroup (readonly)
14 15 16 |
# File 'lib/contender/thread_factory.rb', line 14 def group @group end |
#priority ⇒ Integer
17 18 19 |
# File 'lib/contender/thread_factory.rb', line 17 def priority @priority end |
Instance Method Details
#create { ... } ⇒ Thread
28 29 30 31 32 33 34 35 |
# File 'lib/contender/thread_factory.rb', line 28 def create(&block) thread = Thread.new &block thread.priority = @priority @group.add thread thread end |