io-event 1.16.0 → 1.16.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/ext/io/event/selector/uring.c +18 -13
- data/lib/io/event/selector/select.rb +1 -1
- data/lib/io/event/version.rb +1 -1
- data/readme.md +4 -4
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dd552a5bb53e9a2e9169c55a7f789e84f761a2707c83edd5955512818ad55e25
|
|
4
|
+
data.tar.gz: 97a35fef870d94f7c596d612fdd6664c2e65cff9b14a8cf6b9035b12584f0833
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e187b07cc91e2ecf7fb641a61f481fbb9ba42a1a52c14532fa659ede0a6723dde5ac63e35d7a584d549ca52a94462131f5755b9da7bce1b06abd99f1ea6b3f24
|
|
7
|
+
data.tar.gz: '090f2023d28eac6b05386727f0497bbd02db76b6a3bf0b43f9e068e5e5d36edb543a16c94806fea736c319298b491b1d13e069c7f89bf41a89dd86171b183c96'
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
|
@@ -32,7 +32,6 @@ struct IO_Event_Selector_URing
|
|
|
32
32
|
{
|
|
33
33
|
struct IO_Event_Selector backend;
|
|
34
34
|
struct io_uring ring;
|
|
35
|
-
size_t pending;
|
|
36
35
|
|
|
37
36
|
// Flag indicating whether the selector is currently blocked in a system call.
|
|
38
37
|
// Set to 1 when blocked in io_uring_wait_cqe_timeout() without GVL, 0 otherwise.
|
|
@@ -239,7 +238,6 @@ VALUE IO_Event_Selector_URing_allocate(VALUE self) {
|
|
|
239
238
|
IO_Event_Selector_initialize(&selector->backend, self, Qnil);
|
|
240
239
|
selector->ring.ring_fd = -1;
|
|
241
240
|
|
|
242
|
-
selector->pending = 0;
|
|
243
241
|
selector->blocked = 0;
|
|
244
242
|
selector->interrupt.descriptor = -1;
|
|
245
243
|
selector->wakeup_registered = 0;
|
|
@@ -421,15 +419,14 @@ void IO_Event_Selector_URing_dump_completion_queue(struct IO_Event_Selector_URin
|
|
|
421
419
|
// Flush the submission queue, optionally yielding if unsuccessful.
|
|
422
420
|
static
|
|
423
421
|
int io_uring_submit_all(struct IO_Event_Selector_URing *selector, bool yield) {
|
|
424
|
-
|
|
422
|
+
struct io_uring *ring = &selector->ring;
|
|
423
|
+
|
|
424
|
+
while (io_uring_sq_ready(ring) > 0) {
|
|
425
425
|
int result = io_uring_submit(&selector->ring);
|
|
426
426
|
|
|
427
|
-
if (result
|
|
428
|
-
// io_uring_submit() returns the number of submitted SQEs
|
|
429
|
-
selector->pending -= result;
|
|
430
|
-
} else if (result == -EBUSY || result == -EAGAIN) {
|
|
427
|
+
if (result == -EBUSY || result == -EAGAIN) {
|
|
431
428
|
if (yield) IO_Event_Selector_yield(&selector->backend);
|
|
432
|
-
} else {
|
|
429
|
+
} else if (result < 0) {
|
|
433
430
|
rb_syserr_fail(-result, "io_uring_submit_all:io_uring_submit");
|
|
434
431
|
return result;
|
|
435
432
|
}
|
|
@@ -442,7 +439,10 @@ int io_uring_submit_all(struct IO_Event_Selector_URing *selector, bool yield) {
|
|
|
442
439
|
// Flush the submission queue if pending operations are present.
|
|
443
440
|
static
|
|
444
441
|
int io_uring_submit_flush(struct IO_Event_Selector_URing *selector) {
|
|
445
|
-
if (DEBUG)
|
|
442
|
+
if (DEBUG) {
|
|
443
|
+
unsigned pending = io_uring_sq_ready(&selector->ring);
|
|
444
|
+
fprintf(stderr, "io_uring_submit_flush(pending=%u)\n", pending);
|
|
445
|
+
}
|
|
446
446
|
|
|
447
447
|
return io_uring_submit_all(selector, false);
|
|
448
448
|
}
|
|
@@ -450,15 +450,21 @@ int io_uring_submit_flush(struct IO_Event_Selector_URing *selector) {
|
|
|
450
450
|
// Immediately flush the submission queue, yielding to the event loop if it was not successful.
|
|
451
451
|
static
|
|
452
452
|
int io_uring_submit_now(struct IO_Event_Selector_URing *selector) {
|
|
453
|
-
if (DEBUG)
|
|
454
|
-
|
|
453
|
+
if (DEBUG) {
|
|
454
|
+
unsigned pending = io_uring_sq_ready(&selector->ring);
|
|
455
|
+
fprintf(stderr, "io_uring_submit_now(pending=%u)\n", pending);
|
|
456
|
+
}
|
|
457
|
+
|
|
455
458
|
return io_uring_submit_all(selector, true);
|
|
456
459
|
}
|
|
457
460
|
|
|
458
461
|
// Submit a pending operation. This does not submit the operation immediately, but instead defers it to the next call to `io_uring_submit_flush` or `io_uring_submit_now`. This is useful for operations that are not urgent, but should be used with care as it can lead to a deadlock if the submission queue is not flushed.
|
|
459
462
|
static
|
|
460
463
|
void io_uring_submit_pending(struct IO_Event_Selector_URing *selector) {
|
|
461
|
-
if (DEBUG)
|
|
464
|
+
if (DEBUG) {
|
|
465
|
+
unsigned pending = io_uring_sq_ready(&selector->ring);
|
|
466
|
+
fprintf(stderr, "io_uring_submit_pending(ring=%p, pending=%u)\n", &selector->ring, pending);
|
|
467
|
+
}
|
|
462
468
|
}
|
|
463
469
|
|
|
464
470
|
struct io_uring_sqe * io_get_sqe(struct IO_Event_Selector_URing *selector) {
|
|
@@ -471,7 +477,6 @@ struct io_uring_sqe * io_get_sqe(struct IO_Event_Selector_URing *selector) {
|
|
|
471
477
|
sqe = io_uring_get_sqe(&selector->ring);
|
|
472
478
|
}
|
|
473
479
|
|
|
474
|
-
selector->pending += 1;
|
|
475
480
|
return sqe;
|
|
476
481
|
}
|
|
477
482
|
|
data/lib/io/event/version.rb
CHANGED
data/readme.md
CHANGED
|
@@ -18,6 +18,10 @@ Please see the [project documentation](https://socketry.github.io/io-event/) for
|
|
|
18
18
|
|
|
19
19
|
Please see the [project releases](https://socketry.github.io/io-event/releases/index) for all releases.
|
|
20
20
|
|
|
21
|
+
### v1.16.1
|
|
22
|
+
|
|
23
|
+
- Ensure the pure Ruby `Select` selector returns `false`, not `nil`, when `io_wait` resumes without any ready events.
|
|
24
|
+
|
|
21
25
|
### v1.16.0
|
|
22
26
|
|
|
23
27
|
- Use `eventfd` for `URing` cross-thread wakeup, and enable `IORING_SETUP_SINGLE_ISSUER`, `IORING_SETUP_DEFER_TASKRUN`, and `IORING_SETUP_TASKRUN_FLAG`. The waking thread now signals via `eventfd` rather than submitting a `NOP` SQE, which unlocks the single-issuer optimisation, defers task work to the application thread, and lets `select()` skip the `io_uring_get_events()` syscall when no task work is pending.
|
|
@@ -60,10 +64,6 @@ Please see the [project releases](https://socketry.github.io/io-event/releases/i
|
|
|
60
64
|
|
|
61
65
|
- [Introduce `IO::Event::WorkerPool` for off-loading blocking operations.](https://socketry.github.io/io-event/releases/index#introduce-io::event::workerpool-for-off-loading-blocking-operations.)
|
|
62
66
|
|
|
63
|
-
### v1.10.2
|
|
64
|
-
|
|
65
|
-
- Improved consistency of handling closed IO when invoking `#select`.
|
|
66
|
-
|
|
67
67
|
## Contributing
|
|
68
68
|
|
|
69
69
|
We welcome contributions to this project.
|
data/releases.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Releases
|
|
2
2
|
|
|
3
|
+
## v1.16.1
|
|
4
|
+
|
|
5
|
+
- Ensure the pure Ruby `Select` selector returns `false`, not `nil`, when `io_wait` resumes without any ready events.
|
|
6
|
+
|
|
3
7
|
## v1.16.0
|
|
4
8
|
|
|
5
9
|
- Use `eventfd` for `URing` cross-thread wakeup, and enable `IORING_SETUP_SINGLE_ISSUER`, `IORING_SETUP_DEFER_TASKRUN`, and `IORING_SETUP_TASKRUN_FLAG`. The waking thread now signals via `eventfd` rather than submitting a `NOP` SQE, which unlocks the single-issuer optimisation, defers task work to the application thread, and lets `select()` skip the `io_uring_get_events()` syscall when no task work is pending.
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: io-event
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.16.
|
|
4
|
+
version: 1.16.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Williams
|
|
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
124
|
version: '0'
|
|
125
125
|
requirements: []
|
|
126
|
-
rubygems_version: 4.0.
|
|
126
|
+
rubygems_version: 4.0.10
|
|
127
127
|
specification_version: 4
|
|
128
128
|
summary: An event loop.
|
|
129
129
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|