终止线程失败

时间:2012-03-14 22:01:18

标签: ruby multithreading

我现在遇到终止线程的问题。反正有没有立即杀死一个线程?

def write_data
  linux.execute("/usr/local/bin/pload -w -W -o", timeout=> 10800)
end

def func
  if( a < b)
    th = nil
    th = Thread.new{
      write_data
    }
    th.run

    wait_until(interval=>60,timeout=>never){
      if( b > a)
    }

    th.kill if th and th.alive?
  end
end

0 个答案:

没有答案