thomasdezeeuw / gaea Goto Github PK
View Code? Open in Web Editor NEWLow-level library to build event driven applications, supporting lightweight non-blocking I/O.
Home Page: https://docs.rs/gaea/
License: MIT License
Low-level library to build event driven applications, supporting lightweight non-blocking I/O.
Home Page: https://docs.rs/gaea/
License: MIT License
For example a TcpListener
what Ready
value should it have when registering to get all events? Try to document that for each type.
I don't like the name. The function indicates when the next event might be available and is used to reduce any provided timeout.
From the manual for setsockopt:
SO_KEEPALIVE enables keep connections alive
SO_LINGER linger on close if data present
SO_OOBINLINE enables reception of out-of-band data in band
SO_SNDBUF set buffer size for output
SO_RCVBUF set buffer size for input
SO_SNDLOWAT set minimum count for output
SO_RCVLOWAT set minimum count for input
SO_SNDTIMEO set timeout value for output
SO_RCVTIMEO set timeout value for input
The current tests aren't enough.
Most example use a try_main
function, but Result
can now be returned by main
directly.
expect_no_events
.expect_events
functions in tests.Also some other various small things after the rewrite.
Currently it still refers to the Timer
struct, but that was removed. Now Poller
only has add and remove deadline methods, this name should reflect that.
When documentation the crate from another I get the following warnings:
warning: `[Capacity::Growable]` cannot be resolved, ignoring it...
--> /Users/thomas/.cargo/git/checkouts/mio-st-36dfa78dd2dc66e1/518d5ec/src/event.rs:208:26
|
208 | /// If this returns [`Capacity::Growable`] and the capacity left is
| ^^^^^^^^^^^^^^^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[Source::blocking_poll]` cannot be resolved, ignoring it...
--> /Users/thomas/.cargo/git/checkouts/mio-st-36dfa78dd2dc66e1/518d5ec/src/event.rs:91:26
|
91 | /// [blocking call]: Source::blocking_poll
| ^^^^^^^^^^^^^^^^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[Events]` cannot be resolved, ignoring it...
--> /Users/thomas/.cargo/git/checkouts/mio-st-36dfa78dd2dc66e1/518d5ec/src/event.rs:99:33
|
99 | /// Some implementation of [`Events`] have a limited available capacity.
| ^^^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[Events::capacity_left]` cannot be resolved, ignoring it...
--> /Users/thomas/.cargo/git/checkouts/mio-st-36dfa78dd2dc66e1/518d5ec/src/event.rs:100:51
|
100 | /// This method may not add more events then [`Events::capacity_left`]
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[Source::poll]` cannot be resolved, ignoring it...
--> /Users/thomas/.cargo/git/checkouts/mio-st-36dfa78dd2dc66e1/518d5ec/src/event.rs:109:30
|
109 | /// This is the same as [`Source::poll`] and all requirements of that method
| ^^^^^^^^^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[crate::os::OsQueue::register]` cannot be resolved, ignoring it...
--> /Users/thomas/.cargo/git/checkouts/mio-st-36dfa78dd2dc66e1/518d5ec/src/os/evented.rs:76:31
|
76 | /// [`OsQueue.register`]: crate::os::OsQueue::register
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[crate::os::OsQueue::reregister]` cannot be resolved, ignoring it...
--> /Users/thomas/.cargo/git/checkouts/mio-st-36dfa78dd2dc66e1/518d5ec/src/os/evented.rs:84:33
|
84 | /// [`OsQueue.reregister`]: crate::os::OsQueue::reregister
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
warning: `[crate::os::OsQueue::deregister]` cannot be resolved, ignoring it...
--> /Users/thomas/.cargo/git/checkouts/mio-st-36dfa78dd2dc66e1/518d5ec/src/os/evented.rs:92:33
|
92 | /// [`OsQueue.deregister`]: crate::os::OsQueue::deregister
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
Finished dev [unoptimized + debuginfo] target(s) in 8.90s
For TcpListener
, TcpStream
, UdpSocket
and ConnectedUdpSocket
. [::1]
should do the trick, but I'm not sure if Travis supports ipv6.
Looking at EV_RECEIPT
in https://www.freebsd.org/cgi/man.cgi?query=kqueue&manpath=FreeBSD+11.2-RELEASE+and+Ports (which we use here) I don't think the call to check_errors
is needed here: https://github.com/Thomasdezeeuw/mio-st/blob/master/src/sys/unix/kqueue.rs#L255.
NetBSD doesn't have EVFILT_USER
which the Awakener
uses.
Expand the testing of RegisterOption::EDGE/LEVEL | RegisterOption::ONESHOT
for all types that implement Evented
.
See Q6 of the Q&A in http://man7.org/linux/man-pages/man7/epoll.7.html and EV_DELETE
on https://www.freebsd.org/cgi/man.cgi?query=kqueue&manpath=FreeBSD+11.2-RELEASE+and+Ports.
Currently the tests for the deadline module fail:
All with roughly the same error; the time ran too long.
Tracking issue: rust-lang/rust#58452 and stabilize pr: rust-lang/rust#60334.
Kqueue supports signals with the same API and Linux has signalfd.
Same treatment as #12.
EINTR
(io::ErrorKind::Interrupted
), EWOULDBLOCK
and EAGAIN
(io::ErrorKind::WouldBlock
) are three errors that aren't actually errors and can usually be safely ignored.
This could as simple as adding the PollOpt
to RegistrationInner
and checking for it to be oneshot, if so the first call to notify will also call deregister.
Some of them actually use UdpSocket.
From the paper: "Hashed and Hierarchical Timing Wheels: Efficient Data Structures for Implementing a Timer Facility" by George Varghese and Anthony Lauck.
Commit 64ce7af disabled it.
This would require a number of tests, following tokio-rs/mio#933, tokio-rs/mio#939 and the discussion in mio: tokio-rs/mio#941.
It still mentions ConnectedUdpSocket
, but that is removed.
Since the change to a trait Events
might not be the best name. Something like event::Sink
might be better.
See the error log here: https://cirrus-ci.com/task/5941804527517696.
Even though we can't run the tests for more OSes on Travis we can at least build those targets. Locally I use the following script.
cargo build --target x86_64-apple-darwin
cargo build --target x86_64-unknown-freebsd
# Doesn't have EVFILT_USER, used in Awakener.
#cargo build --target x86_64-unknown-netbsd
cargo build --target x86_64-unknown-linux-gnu
cargo build --target x86_64-unknown-linux-musl
Also a good test of the flexibility and usability of the event::Source
trait.
If we drop bitflags and ensure that the interests provided to register
and reregister
are never we can drop the not_empty
check. This also means we can drop PollCalled
.
I think this may be wrong. It should be edge-triggered instead. Here is why:
If you look at the test above, it seems to be checking that two different events are triggered subsequently. But this is not true. This simply works because the eventfd has been set level-triggered, meaning that each time epoll_wait is called, it will produce an event that data is available, because of the fact that we are not reading from the eventfd at-all!
This observation can be reproduced by simply commenting-out the lines 51-54. You will see that the test passes, because you are actually testing some other semantics and not the actual one here.
Solution: The eventfd should be registered edge-triggered.
One that simply describes what the examples do.
Maybe dion
from https://en.wikipedia.org/wiki/Dionysus.
Some of the use of unsafe code is incorrect I think. For example the use of mem::uninitialized
should be replaced with mem::MaybeUninit
(currently unstable).
Currently use after fork is somewhat vague. For exampe kqueue won't work after fork
, but epoll might. We need to make it consistent.
Currently poll
has two generic parameters of which the error is almost never inferred, e.g. from the example of the crate docs.
poll::<_, io::Error>(&mut [&mut os_queue], &mut events, None)?;
// ^^^^^^^^^^^^^^ Don't like this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.