event 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d1a02b3163aca45dcdb7ac4f3589e18894c3e753262d7934ea0f473c88e2a38
4
- data.tar.gz: fac7fd3d48e616e1c03ca9cb6af19b8457c4dadb452261bb1f4b628d70297bcb
3
+ metadata.gz: df986c171ee38a8b081284b28cb7972f3b7ba96b60d47d370ccac6808fe01ff9
4
+ data.tar.gz: fd87f66165976f4704e9244f044aedda6a949c87f2879ede07cfc728a24f778e
5
5
  SHA512:
6
- metadata.gz: 54c8d94a288dc450decd427c2bd7af850b635133b90ca25ee15f4f934c3e9b78cd8465402d1fabb9c4bae8ae3b7fef8c1849567e23303601a2bca4dfefc9acf3
7
- data.tar.gz: 757e2b00714ace1767d732ab37c93372bd44d14da4911f46190b8ba0efcb1ba249743509fc3c68e957c4b24804ddd35a844257b81e279de0f3fd487d1058015e
6
+ metadata.gz: e522241d001f0d42b364ab51ff0e555c4cbde87daf91f3bedcd93bb8c14ee8a351b413b6156d7f9e94606c3a7536de39fcc71ef2525d85c420c6def51a092cc5
7
+ data.tar.gz: 297fe75b5789cb10dc32807a2a78bf36514773c1d41646cf1163c6fd7be7ecbedd1239bed631ff825836934dab9fc08eccfb27a2d15d39abb08159b05d01b95c
@@ -112,6 +112,16 @@ VALUE Event_Selector_EPoll_close(VALUE self) {
112
112
  return Qnil;
113
113
  }
114
114
 
115
+ VALUE Event_Selector_EPoll_transfer(VALUE self)
116
+ {
117
+ struct Event_Selector_EPoll *data = NULL;
118
+ TypedData_Get_Struct(self, struct Event_Selector_EPoll, &Event_Selector_EPoll_Type, data);
119
+
120
+ Event_Selector_fiber_transfer(data->backend.loop, 0, NULL);
121
+
122
+ return Qnil;
123
+ }
124
+
115
125
  VALUE Event_Selector_EPoll_resume(int argc, VALUE *argv, VALUE self)
116
126
  {
117
127
  struct Event_Selector_EPoll *data = NULL;
@@ -550,6 +560,7 @@ void Init_Event_Selector_EPoll(VALUE Event_Selector) {
550
560
  rb_define_alloc_func(Event_Selector_EPoll, Event_Selector_EPoll_allocate);
551
561
  rb_define_method(Event_Selector_EPoll, "initialize", Event_Selector_EPoll_initialize, 1);
552
562
 
563
+ rb_define_method(Event_Selector_EPoll, "transfer", Event_Selector_EPoll_transfer, 0);
553
564
  rb_define_method(Event_Selector_EPoll, "resume", Event_Selector_EPoll_resume, -1);
554
565
  rb_define_method(Event_Selector_EPoll, "yield", Event_Selector_EPoll_yield, 0);
555
566
  rb_define_method(Event_Selector_EPoll, "push", Event_Selector_EPoll_push, 1);
@@ -112,6 +112,16 @@ VALUE Event_Selector_KQueue_close(VALUE self) {
112
112
  return Qnil;
113
113
  }
114
114
 
115
+ VALUE Event_Selector_KQueue_transfer(VALUE self)
116
+ {
117
+ struct Event_Selector_KQueue *data = NULL;
118
+ TypedData_Get_Struct(self, struct Event_Selector_KQueue, &Event_Selector_KQueue_Type, data);
119
+
120
+ Event_Selector_fiber_transfer(data->backend.loop, 0, NULL);
121
+
122
+ return Qnil;
123
+ }
124
+
115
125
  VALUE Event_Selector_KQueue_resume(int argc, VALUE *argv, VALUE self)
116
126
  {
117
127
  struct Event_Selector_KQueue *data = NULL;
@@ -616,6 +626,7 @@ void Init_Event_Selector_KQueue(VALUE Event_Selector) {
616
626
  rb_define_alloc_func(Event_Selector_KQueue, Event_Selector_KQueue_allocate);
617
627
  rb_define_method(Event_Selector_KQueue, "initialize", Event_Selector_KQueue_initialize, 1);
618
628
 
629
+ rb_define_method(Event_Selector_KQueue, "transfer", Event_Selector_KQueue_transfer, 0);
619
630
  rb_define_method(Event_Selector_KQueue, "resume", Event_Selector_KQueue_resume, -1);
620
631
  rb_define_method(Event_Selector_KQueue, "yield", Event_Selector_KQueue_yield, 0);
621
632
  rb_define_method(Event_Selector_KQueue, "push", Event_Selector_KQueue_push, 1);
@@ -115,6 +115,16 @@ VALUE Event_Selector_URing_close(VALUE self) {
115
115
  return Qnil;
116
116
  }
117
117
 
118
+ VALUE Event_Selector_URing_transfer(VALUE self)
119
+ {
120
+ struct Event_Selector_URing *data = NULL;
121
+ TypedData_Get_Struct(self, struct Event_Selector_URing, &Event_Selector_URing_Type, data);
122
+
123
+ Event_Selector_fiber_transfer(data->backend.loop, 0, NULL);
124
+
125
+ return Qnil;
126
+ }
127
+
118
128
  VALUE Event_Selector_URing_resume(int argc, VALUE *argv, VALUE self)
119
129
  {
120
130
  struct Event_Selector_URing *data = NULL;
@@ -615,6 +625,7 @@ void Init_Event_Selector_URing(VALUE Event_Selector) {
615
625
  rb_define_alloc_func(Event_Selector_URing, Event_Selector_URing_allocate);
616
626
  rb_define_method(Event_Selector_URing, "initialize", Event_Selector_URing_initialize, 1);
617
627
 
628
+ rb_define_method(Event_Selector_URing, "transfer", Event_Selector_URing_transfer, 0);
618
629
  rb_define_method(Event_Selector_URing, "resume", Event_Selector_URing_resume, -1);
619
630
  rb_define_method(Event_Selector_URing, "yield", Event_Selector_URing_yield, 0);
620
631
  rb_define_method(Event_Selector_URing, "push", Event_Selector_URing_push, 1);
@@ -50,6 +50,11 @@ module Event
50
50
  end
51
51
  end
52
52
 
53
+ # Transfer from the current fiber to the event loop.
54
+ def transfer
55
+ @loop.transfer
56
+ end
57
+
53
58
  # Transfer from the current fiber to the specified fiber. Put the current fiber into the ready list.
54
59
  def resume(fiber, *arguments)
55
60
  queue = Queue.new(Fiber.current)
data/lib/event/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Event
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams