Sha256: 145b28dde64339b6a88d1d19e129b977776f1b8914979c7f5653cf93fb268e02

Contents?: true

Size: 612 Bytes

Versions: 7

Compression:

Stored size: 612 Bytes

Contents

# Copyright (C) 2003-2006 Kouichirou Eto, All rights reserved.
# This is free software with ABSOLUTELY NO WARRANTY.
# You can redistribute it and/or modify it under the terms of the GNU GPL 2.

def check_monitor_main
  require 'monitor.rb'

  buf = []
  buf.extend(MonitorMixin)
  empty_cond = buf.new_cond

  # consumer
  Thread.start {
    loop {
      buf.synchronize {
	empty_cond.wait_while { buf.empty? }
	print buf.shift
      }
    }
  }

  # producer
  while line = ARGF.gets
    buf.synchronize {
      buf.push(line)
      empty_cond.signal
    }
  end
end

if $0 == __FILE__
  check_monitor_main
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
qwik2md-2.0.1 vendor/qwik/lib/qwik/check-monitor.rb
qwik2md-2.0.0 vendor/qwik/lib/qwik/check-monitor.rb
qwik2md-1.0.2 vendor/qwik/lib/qwik/check-monitor.rb
qwik2md-1.0.1 vendor/qwik/lib/qwik/check-monitor.rb
qwik2md-1.0.0 vendor/qwik/lib/qwik/check-monitor.rb
qwik2md-0.1.0 vendor/qwik/lib/qwik/check-monitor.rb
qwikdoc-0.0.1 vendor/qwik/check-monitor.rb