Ruby 2.4.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Threadクラス > stop

singleton method Thread.stop

stop -> nil[permalink][rdoc]

他のスレッドから Thread#run メソッドで再起動されるまで、カレントスレッドの実行を停止します。



a = Thread.new { print "a"; Thread.stop; print "c" }
sleep 0.1 while a.status!='sleep'
print "b"
a.run
a.join
# => "abc"

[SEE_ALSO] Thread#run, Thread#wakeup