evt 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/ext/evt/kqueue.h +0 -1
- data/ext/evt/uring.h +11 -13
- data/lib/evt/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9466e3fd37da9807dc59525feebfe9252489a460a83111febf95973ff77fee56
|
4
|
+
data.tar.gz: 531808277a49049dc156144294346730a457d717699e091348125086dca529de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/ext/evt/kqueue.h
CHANGED
@@ -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);
|
data/ext/evt/uring.h
CHANGED
@@ -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 (
|
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,
|
110
|
+
rb_funcall(rb_mKernel, id_sleep, 1, rb_float_new(time));
|
112
111
|
} else {
|
113
|
-
rb_funcall(rb_mKernel, id_sleep, 1,
|
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
|
}
|
data/lib/evt/version.rb
CHANGED