Class: Thread

Inherits:
Object show all
Defined in:
lib/patch/foobar.rb

Overview

Extends the Thread class.

Class Method Summary collapse

Class Method Details

.othersArray<Thread>

Returns an array of all live threads except the current thread. A static class method.

Examples:

thread1 = Thread.new { sleep 1 }
thread2 = Thread.new { sleep 1 }
# In the main thread:
Thread.others # => might include thread1, thread2 (depending on timing)


332
333
334
# File 'lib/patch/foobar.rb', line 332

def self.others
  Thread.list.reject { |x| x == Thread.current }
end