Class: Nanoc::Core::CompilationPhases::Write::Worker
- Inherits:
-
Object
- Object
- Nanoc::Core::CompilationPhases::Write::Worker
- Defined in:
- lib/nanoc/core/compilation_phases/write.rb
Instance Method Summary collapse
-
#initialize(queue:, compiled_content_store:) ⇒ Worker
constructor
A new instance of Worker.
- #join ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(queue:, compiled_content_store:) ⇒ Worker
Returns a new instance of Worker.
10 11 12 13 |
# File 'lib/nanoc/core/compilation_phases/write.rb', line 10 def initialize(queue:, compiled_content_store:) @queue = queue @compiled_content_store = compiled_content_store end |
Instance Method Details
#join ⇒ Object
28 29 30 |
# File 'lib/nanoc/core/compilation_phases/write.rb', line 28 def join @thread.join end |
#start ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/nanoc/core/compilation_phases/write.rb', line 15 def start @thread = Thread.new do Thread.current.abort_on_exception = true Thread.current.priority = -1 # schedule I/O work ASAP writer = Nanoc::Core::ItemRepWriter.new while rep = @queue.pop # rubocop:disable Lint/AssignmentInCondition writer.write_all(rep, @compiled_content_store) end end end |