nio4r 0.4.2-java → 0.4.3-java

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.4.3
2
+ -----
3
+ * REALLY have thread synchronization when closing selectors ;)
4
+
1
5
  0.4.2
2
6
  -----
3
7
  * Attempt to work around packaging problems with bundler-api o_O
@@ -37,6 +37,7 @@ static VALUE NIO_Selector_register_synchronized(VALUE *args);
37
37
  static VALUE NIO_Selector_deregister_synchronized(VALUE *args);
38
38
  static VALUE NIO_Selector_select_synchronized(VALUE *args);
39
39
  static VALUE NIO_Selector_close_synchronized(VALUE self);
40
+ static VALUE NIO_Selector_closed_synchronized(VALUE self);
40
41
 
41
42
  static int NIO_Selector_run(struct NIO_Selector *selector, VALUE timeout);
42
43
  static void NIO_Selector_timeout_callback(struct ev_loop *ev_loop, struct ev_timer *timer, int revents);
@@ -117,11 +118,6 @@ static void NIO_Selector_mark(struct NIO_Selector *selector)
117
118
  Called by both NIO::Selector#close and the finalizer below */
118
119
  static void NIO_Selector_shutdown(struct NIO_Selector *selector)
119
120
  {
120
- if(selector->ev_loop) {
121
- ev_loop_destroy(selector->ev_loop);
122
- selector->ev_loop = 0;
123
- }
124
-
125
121
  if(selector->closed) {
126
122
  return;
127
123
  }
@@ -129,6 +125,10 @@ static void NIO_Selector_shutdown(struct NIO_Selector *selector)
129
125
  close(selector->wakeup_reader);
130
126
  close(selector->wakeup_writer);
131
127
 
128
+ if(selector->ev_loop) {
129
+ ev_loop_destroy(selector->ev_loop);
130
+ selector->ev_loop = 0;
131
+ }
132
132
  selector->closed = 1;
133
133
  }
134
134
 
@@ -379,6 +379,11 @@ static VALUE NIO_Selector_wakeup(VALUE self)
379
379
 
380
380
  /* Close the selector and free system resources */
381
381
  static VALUE NIO_Selector_close(VALUE self)
382
+ {
383
+ return NIO_Selector_synchronize(self, NIO_Selector_close_synchronized, self);
384
+ }
385
+
386
+ static VALUE NIO_Selector_close_synchronized(VALUE self)
382
387
  {
383
388
  struct NIO_Selector *selector;
384
389
  Data_Get_Struct(self, struct NIO_Selector, selector);
@@ -391,10 +396,10 @@ static VALUE NIO_Selector_close(VALUE self)
391
396
  /* Is the selector closed? */
392
397
  static VALUE NIO_Selector_closed(VALUE self)
393
398
  {
394
- return NIO_Selector_synchronize(self, NIO_Selector_close_synchronized, self);
399
+ return NIO_Selector_synchronize(self, NIO_Selector_closed_synchronized, self);
395
400
  }
396
401
 
397
- static VALUE NIO_Selector_close_synchronized(VALUE self)
402
+ static VALUE NIO_Selector_closed_synchronized(VALUE self)
398
403
  { struct NIO_Selector *selector;
399
404
  Data_Get_Struct(self, struct NIO_Selector, selector);
400
405
 
@@ -405,7 +410,7 @@ static VALUE NIO_Selector_close_synchronized(VALUE self)
405
410
  static VALUE NIO_Selector_is_empty(VALUE self)
406
411
  {
407
412
  VALUE selectables = rb_ivar_get(self, rb_intern("selectables"));
408
-
413
+
409
414
  return rb_funcall(selectables, rb_intern("empty?"), 0) == Qtrue ? Qtrue : Qfalse;
410
415
  }
411
416
 
@@ -1,3 +1,3 @@
1
1
  module NIO
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
@@ -1,3 +1,5 @@
1
+ require 'spec_helper'
2
+
1
3
  describe "NIO acceptables" do
2
4
  shared_context "an NIO acceptable" do
3
5
  let(:selector) { NIO::Selector.new }
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: nio4r
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.2
5
+ version: 0.4.3
6
6
  platform: java
7
7
  authors:
8
8
  - Tony Arcieri
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-13 00:00:00.000000000 Z
12
+ date: 2012-11-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler