evt 0.2.0 → 0.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 792dc614f6216687c600f101b8fac515a71fc0249c4ca6af3f880cb71ee17eff
4
- data.tar.gz: c64b75645bd2adb22a3947c7b239c9cde05a8fb1ac42a6e08f2cfe653bc20a84
3
+ metadata.gz: 9466e3fd37da9807dc59525feebfe9252489a460a83111febf95973ff77fee56
4
+ data.tar.gz: 531808277a49049dc156144294346730a457d717699e091348125086dca529de
5
5
  SHA512:
6
- metadata.gz: '016090b4ba576eb10896099d3879445d3c65d3b8f6d9475731786639282c5e7f37ba1029e6d1201b165f9bfbf20193fb13017b5ea6af90792b60989f33691899'
7
- data.tar.gz: 83d15ffca0e28b5c96f241197bbd97eabe1a935e01f71c6e4bb94a2eb9ad413148b2318d1b55a4df4b11444e989508b32cd7da9f1b19b839512d13b92b7034b9
6
+ metadata.gz: c12a241295309fd31bf21bc4957374a636ff046b6aa1c5f670113f0cdeedb3df74f974145ba6f19f9e442d5f8d9ae373d70bfee6ae417dc09e9b620d57bcc78f
7
+ data.tar.gz: b3a369c7640d4770a89e7d37166930a757ca25266132fbd0544f2f0a065670de1c13578ea4cf7fc43ad1fb2c2020757b20cc972e85c23cab720bb229103fb070
data/README.md CHANGED
@@ -4,7 +4,9 @@ The Event Library that designed for Ruby 3.0.
4
4
 
5
5
  **This gem is still under development, APIs and features are not stable. Advices and PRs are highly welcome.**
6
6
 
7
- ![CI Tests](https://github.com/dsh0416/evt/workflows/CI%20Tests/badge.svg)
7
+ [![CI Tests](https://github.com/dsh0416/evt/workflows/CI%20Tests/badge.svg)](https://github.com/dsh0416/evt/actions?query=workflow%3A%22CI+Tests%22)
8
+ [![Gem Version](https://badge.fury.io/rb/evt.svg)](https://rubygems.org/gems/evt)
9
+ [![Downloads](https://ruby-gem-downloads-badge.herokuapp.com/evt?type=total)](https://rubygems.org/gems/evt)
8
10
 
9
11
  ## Features
10
12
 
@@ -70,7 +70,6 @@ VALUE method_scheduler_wait(VALUE self) {
70
70
  // TODO: Check if n >= 0
71
71
  for (i = 0; i < n; i++) {
72
72
  event_flags = events[i].filter;
73
- printf("event flags: %d\n", event_flags);
74
73
  if (event_flags & EVFILT_READ) {
75
74
  obj_io = (VALUE) events[i].udata;
76
75
  rb_funcall(readables, id_push, 1, obj_io);
@@ -90,27 +90,26 @@ VALUE method_scheduler_wait(VALUE self) {
90
90
  data = (struct uring_data*) io_uring_cqe_get_data(cqes[i]);
91
91
  poll_events = data->poll_mask;
92
92
  obj_io = data->io;
93
- if (!data->is_poll) {
93
+ if (data->is_poll) {
94
+ if (poll_events & POLL_IN) {
95
+ rb_funcall(readables, id_push, 1, obj_io);
96
+ }
97
+
98
+ if (poll_events & POLL_OUT) {
99
+ rb_funcall(writables, id_push, 1, obj_io);
100
+ }
101
+ } else {
94
102
  rb_funcall(iovs, id_push, 1, obj_io);
95
103
  }
96
-
97
- if (poll_events & POLL_IN) {
98
- rb_funcall(readables, id_push, 1, obj_io);
99
- }
100
-
101
- if (poll_events & POLL_OUT) {
102
- rb_funcall(writables, id_push, 1, obj_io);
103
- }
104
- xfree(data);
105
104
  }
106
105
 
107
106
  if (ret == 0) {
108
107
  if (next_timeout != Qnil && NUM2INT(next_timeout) != -1) {
109
108
  // sleep
110
109
  time = next_timeout / 1000;
111
- rb_funcall(rb_mKernel, id_sleep, 1, RFLOAT_VALUE(time));
110
+ rb_funcall(rb_mKernel, id_sleep, 1, rb_float_new(time));
112
111
  } else {
113
- rb_funcall(rb_mKernel, id_sleep, 1, RFLOAT_VALUE(0.001)); // To avoid infinite loop
112
+ rb_funcall(rb_mKernel, id_sleep, 1, rb_float_new(0.001)); // To avoid infinite loop
114
113
  }
115
114
  }
116
115
 
@@ -152,7 +151,6 @@ VALUE method_scheduler_io_read(VALUE self, VALUE io, VALUE buffer, VALUE offset,
152
151
  io_uring_submit(ring);
153
152
 
154
153
  VALUE result = rb_str_new(read_buffer, strlen(read_buffer));
155
- xfree(read_buffer);
156
154
  if (buffer != Qnil) {
157
155
  rb_str_append(buffer, result);
158
156
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Evt
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delton Ding