listen 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +173 -167
- data/LICENSE +20 -20
- data/lib/listen/adapters/polling.rb +1 -1
- data/lib/listen/directory_record.rb +344 -318
- data/lib/listen/listener.rb +203 -203
- data/lib/listen/multi_listener.rb +121 -121
- data/lib/listen/turnstile.rb +28 -28
- data/lib/listen/version.rb +3 -3
- metadata +11 -15
data/lib/listen/turnstile.rb
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
module Listen
|
2
|
-
# Allows two threads to wait on eachother.
|
3
|
-
#
|
4
|
-
# @note Only two threads can be used with this Turnstile
|
5
|
-
# because of the current implementation.
|
6
|
-
class Turnstile
|
7
|
-
|
8
|
-
# Initialize the turnstile.
|
9
|
-
#
|
10
|
-
def initialize
|
11
|
-
# Until ruby offers semahpores, only queues can be used
|
12
|
-
# to implement a turnstile.
|
13
|
-
@q = Queue.new
|
14
|
-
end
|
15
|
-
|
16
|
-
# Blocks the current thread until a signal is received.
|
17
|
-
#
|
18
|
-
def wait
|
19
|
-
@q.pop if @q.num_waiting == 0
|
20
|
-
end
|
21
|
-
|
22
|
-
# Unblocks the waiting thread if there is one.
|
23
|
-
#
|
24
|
-
def signal
|
25
|
-
@q.push :dummy if @q.num_waiting == 1
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
1
|
+
module Listen
|
2
|
+
# Allows two threads to wait on eachother.
|
3
|
+
#
|
4
|
+
# @note Only two threads can be used with this Turnstile
|
5
|
+
# because of the current implementation.
|
6
|
+
class Turnstile
|
7
|
+
|
8
|
+
# Initialize the turnstile.
|
9
|
+
#
|
10
|
+
def initialize
|
11
|
+
# Until ruby offers semahpores, only queues can be used
|
12
|
+
# to implement a turnstile.
|
13
|
+
@q = Queue.new
|
14
|
+
end
|
15
|
+
|
16
|
+
# Blocks the current thread until a signal is received.
|
17
|
+
#
|
18
|
+
def wait
|
19
|
+
@q.pop if @q.num_waiting == 0
|
20
|
+
end
|
21
|
+
|
22
|
+
# Unblocks the waiting thread if there is one.
|
23
|
+
#
|
24
|
+
def signal
|
25
|
+
@q.push :dummy if @q.num_waiting == 1
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/listen/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module Listen
|
2
|
-
VERSION = '0.5.
|
3
|
-
end
|
1
|
+
module Listen
|
2
|
+
VERSION = '0.5.2'
|
3
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: listen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-09-
|
13
|
+
date: 2012-09-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -37,18 +37,18 @@ executables: []
|
|
37
37
|
extensions: []
|
38
38
|
extra_rdoc_files: []
|
39
39
|
files:
|
40
|
-
- lib/listen.rb
|
41
|
-
- lib/listen/dependency_manager.rb
|
42
|
-
- lib/listen/version.rb
|
43
40
|
- lib/listen/adapter.rb
|
44
|
-
- lib/listen/multi_listener.rb
|
45
|
-
- lib/listen/listener.rb
|
46
|
-
- lib/listen/turnstile.rb
|
47
|
-
- lib/listen/directory_record.rb
|
48
|
-
- lib/listen/adapters/polling.rb
|
49
41
|
- lib/listen/adapters/darwin.rb
|
50
42
|
- lib/listen/adapters/linux.rb
|
43
|
+
- lib/listen/adapters/polling.rb
|
51
44
|
- lib/listen/adapters/windows.rb
|
45
|
+
- lib/listen/dependency_manager.rb
|
46
|
+
- lib/listen/directory_record.rb
|
47
|
+
- lib/listen/listener.rb
|
48
|
+
- lib/listen/multi_listener.rb
|
49
|
+
- lib/listen/turnstile.rb
|
50
|
+
- lib/listen/version.rb
|
51
|
+
- lib/listen.rb
|
52
52
|
- CHANGELOG.md
|
53
53
|
- LICENSE
|
54
54
|
- README.md
|
@@ -64,9 +64,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
64
|
- - ! '>='
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: '0'
|
67
|
-
segments:
|
68
|
-
- 0
|
69
|
-
hash: -1041051149
|
70
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
68
|
none: false
|
72
69
|
requirements:
|
@@ -75,9 +72,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
72
|
version: 1.3.6
|
76
73
|
requirements: []
|
77
74
|
rubyforge_project: listen
|
78
|
-
rubygems_version: 1.8.
|
75
|
+
rubygems_version: 1.8.23
|
79
76
|
signing_key:
|
80
77
|
specification_version: 3
|
81
78
|
summary: Listen to file modifications
|
82
79
|
test_files: []
|
83
|
-
has_rdoc:
|