class SyncOut
Public Class Methods
convertConfNum(str)
click to toggle source
# File lib/common/ext/stdout.rb, line 92 def self.convertConfNum(str) if Bake.options.syncedOutput while str.sub!(">>CONF_NUM<<", Bake::Blocks::Block.block_counter.to_s) do Bake::Blocks::Block.inc_block_counter end end end
discardStreams()
click to toggle source
# File lib/common/ext/stdout.rb, line 118 def self.discardStreams() mutex.synchronize do Thread.current[:stdout] = Thread.current[:tmpStdout] ? Thread.current[:tmpStdout].pop : nil end end
flushOutput()
click to toggle source
# File lib/common/ext/stdout.rb, line 70 def self.flushOutput mutex.synchronize do tmp = Thread.current[:stdout] if tmp.string.length > 0 Thread.current[:stdout] = Thread.current[:tmpStdout][Thread.current[:tmpStdout].length-1] puts tmp.string tmp.reopen("") Thread.current[:stdout] = tmp end end end
mutex()
click to toggle source
# File lib/common/ext/stdout.rb, line 66 def self.mutex @@mutex ||= Mutex.new end
startStream()
click to toggle source
# File lib/common/ext/stdout.rb, line 82 def self.startStream s = StringIO.new if Thread.current[:tmpStdout].nil? Thread.current[:tmpStdout] = [Thread.current[:stdout]] else Thread.current[:tmpStdout] << Thread.current[:stdout] end Thread.current[:stdout] = s end
stopStream()
click to toggle source
# File lib/common/ext/stdout.rb, line 100 def self.stopStream() mutex.synchronize do s = Thread.current[:stdout] return if s.nil? Thread.current[:stdout] = Thread.current[:tmpStdout] ? Thread.current[:tmpStdout].pop : nil if s.string.length > 0 convertConfNum(s.string) puts s.string s.reopen("") end end end