File: run.rb

package info (click to toggle)
libosl 0.8.0-4.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,328 kB
  • sloc: cpp: 114,345; ruby: 1,290; ansic: 915; makefile: 431; perl: 309; sh: 35
file content (24 lines) | stat: -rwxr-xr-x 404 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /usr/bin/env ruby

require 'thread'
require './machine-conf.rb'

files = Dir[ARGV[0] + "/*.csa"]
mutex = Mutex.new
threads = []
MACHINES.each {|machine|
  threads << Thread.new(machine) {|x|
    while true
      file = nil
      mutex.synchronize do
	file = files.shift
      end
      break unless file
      system("rsh #{x} '#{COMMAND} #{ARG} #{file}'")
    end
  }
}

threads.each {|x|
  x.join
}