Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding binary for actually running the thing.

No tests, plenty of threads. This was originally a one-file deal all done as a spike, so at least there are some tests for parts, but I'm not sure how to test this completely.

Also, since threads are involved I'll probably need to add Mutexes.
  • Loading branch information...
commit a1ef1e3b6f90d30f09f1d10c62e8b4db43f84903 1 parent 60feaa0
@ymendel authored
Showing with 37 additions and 0 deletions.
  1. +37 −0 bin/music_conversion_observer
View
37 bin/music_conversion_observer
@@ -0,0 +1,37 @@
+#!/usr/bin/env ruby
+
+$:.unshift('./lib')
+require 'conversion_observer'
+
+threads = {}
+threads[:collector] = Thread.new do
+ begin
+ collector = ConversionObserver::Collector.new
+ collector.prepare
+ collector.run
+ rescue Interrupt
+ collector.shutdown
+ end
+end
+
+threads[:checker] = Thread.new do
+ checker = ConversionObserver::Checker.new
+
+ loop do
+ if checker.run
+ sleep 0.5
+ else
+ Thread.pass
+ end
+ end
+end
+
+threads[:consumer] = Thread.new do
+ consumer = ConversionObserver::Consumer.new
+
+ loop do
+ consumer.run or Thread.pass
+ end
+end
+
+threads.each { |name, thread| thread.join }
Please sign in to comment.
Something went wrong with that request. Please try again.