listen 3.1.4 → 3.3.0.pre.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,29 +0,0 @@
1
- module Listen
2
- # @private api
3
- module Internals
4
- module ThreadPool
5
- def self.add(&block)
6
- Thread.new { block.call }.tap do |th|
7
- (@threads ||= Queue.new) << th
8
- end
9
- end
10
-
11
- def self.stop
12
- return unless @threads ||= nil
13
- return if @threads.empty? # return to avoid using possibly stubbed Queue
14
-
15
- killed = Queue.new
16
- # You can't kill a read on a descriptor in JRuby, so let's just
17
- # ignore running threads (listen rb-inotify waiting for disk activity
18
- # before closing) pray threads die faster than they are created...
19
- limit = RUBY_ENGINE == 'jruby' ? [1] : []
20
-
21
- killed << @threads.pop.kill until @threads.empty?
22
- until killed.empty?
23
- th = killed.pop
24
- th.join(*limit) unless th[:listen_blocking_read_thread]
25
- end
26
- end
27
- end
28
- end
29
- end