mailbox 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 2
4
- :patch: 3
4
+ :patch: 4
5
5
  :build:
@@ -28,6 +28,10 @@ module Mailbox
28
28
  @__verbose_target__ = method_name
29
29
  end
30
30
 
31
+ def dispose
32
+ __fiber__.dispose
33
+ end
34
+
31
35
  class << self
32
36
  # Used to tell +Mailbox+ that all +mailslot+
33
37
  # methods should be run on the calling thread.
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mailbox}
8
- s.version = "0.2.3"
8
+ s.version = "0.2.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joel Friedman", "Patrick Farley"]
12
- s.date = %q{2010-05-18}
12
+ s.date = %q{2010-06-02}
13
13
  s.description = %q{Mailbox is a JRuby module that simplifies concurrency and is backed by JVM threads.}
14
14
  s.email = %q{asher.friedman@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -291,4 +291,24 @@ class MailboxTest < Test::Unit::TestCase
291
291
  assert_equal expected, test_agent.msg_info
292
292
  end
293
293
 
294
+ def test_dispose
295
+ klass = Class.new do
296
+ include Mailbox
297
+ mailslot
298
+ def count_down(latch)
299
+ latch.count_down
300
+ end
301
+ end
302
+
303
+ test_agent = klass.new
304
+ latch = JRL::Concurrent::Latch.new 1
305
+ test_agent.count_down latch
306
+ assert latch.await(1), "timed out waiting for first latch"
307
+
308
+ test_agent.dispose
309
+
310
+ latch = JRL::Concurrent::Latch.new 1
311
+ test_agent.count_down latch
312
+ assert !latch.await(1), "latch didn't time out after fiber was disposed"
313
+ end
294
314
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 3
9
- version: 0.2.3
8
+ - 4
9
+ version: 0.2.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Joel Friedman
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-05-18 00:00:00 -05:00
18
+ date: 2010-06-02 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency