4223 Commits

Author SHA1 Message Date
Alex Crichton
6c6fb917ee Merge pull request #8 from nbigaouette/patch-1
Fix typo in Loop::run() documentation
2016-09-01 09:00:14 -07:00
Nicolas Bigaouette
376974c349 Fix typo in Loop::run() documentation
Simple typo fixed (`becuase` -> `because`)
2016-08-31 22:35:19 -04:00
Alex Crichton
330ab823b0 Update to futures master
* Remove `LoopData` as it's no longer necessary
* Add `LoopHandle::spawn` to spawn new futures onto an event loop
* Add `LoopData::spawn` to also spawn new futures onto an event loop
* Rejigger the implementation of the event loop a bit (make a slab of futures),
  but otherwise everything else is pretty constant.
2016-08-31 19:00:42 -07:00
Carl Lerche
440a813c5a Track mio master 2016-08-30 14:45:29 -07:00
Alex Crichton
7a852a7f49 Merge pull request #4 from sinkuu/fix_dropbox
Fix DropBox's drop
2016-08-28 10:56:11 -07:00
sinkuu
909f3e923c Fix DropBox's drop 2016-08-28 16:06:45 +09:00
Alex Crichton
c820d67d66 Update to mio master 2016-08-27 12:33:31 -07:00
Alex Crichton
b9395808be Merge pull request #1 from sbstp/typo
Fix typo in panic message
2016-08-26 19:11:51 -07:00
Simon Bernier St-Pierre
32557cd832 fix typo in panic message 2016-08-26 21:47:50 -04:00
Alex Crichton
3715e62471 Update appveyor link 2016-08-26 14:57:55 -07:00
Alex Crichton
235812a4da Add license files 2016-08-26 14:56:21 -07:00
Alex Crichton
37a53a1085 Update appveyor status 2016-08-26 14:51:40 -07:00
Alex Crichton
347669ed2b Add appveyor config 2016-08-26 14:45:55 -07:00
Alex Crichton
d6e8998582 Update travis token 2016-08-26 14:44:01 -07:00
Alex Crichton
f107c8d860 Rename to tokio-core, add in futures-io
Renames the futures-mio crate to tokio-core, pulls in the futures-io crate under
an `io` module, and gets everything compiling.
2016-08-26 14:39:47 -07:00
Alex Crichton
e71d509fee Add a &LoopPin to add_loop_data closures
This way they can use that proof that they're running on the event loop
2016-08-24 18:44:47 -07:00
Alex Crichton
d1cd455225 Implement Stream for Receiver
That's... what it is!
2016-08-22 10:10:03 -07:00
Aaron Turon
cff73b7a9d Merge pull request #87 from alexcrichton/less-arc
Don't store an Arc in ReadinessStream
2016-08-21 21:18:53 -07:00
Jean Pierre Dudey
9c309af597 Update futures-mio tests 2016-08-21 11:30:59 -04:00
Alex Crichton
df9730fcbe Add a channel to the futures-mio crate 2016-08-20 23:41:19 -07:00
Alex Crichton
2bd616df51 Reorganize the event_loop module
Split it up into a number of targeted modules for each purpose, for example loop
data, I/O sources, timeouts, and channels. No actual change is intended to be
part of this commit.
2016-08-20 23:24:56 -07:00
Alex Crichton
b9dae23e3f Don't store an Arc in ReadinessStream
This commit contains a few refactorings, but the major goal is to remove the
`Arc` that's stored inside of each `ReadinessStream` and `Scheduled` slot in the
event loop. The original purpose of this `Arc` was to share the I/O object among
the concrete handle itself and the event loop. The event loop would then change
how the socket is registered over time and then deregister it when it gets a
"shutdown request".

Nowadays, however, once an I/O object is registered with the event loop it's
never updated. Additionally, we don't actually need to call `deregister` but can
rather just instead close the I/O object itself and let the kernel/event loop
take care of the cleanup. All we need to do on deregistering is free up the slab
entry.

The major result of this commit is that I/O objects no longer need to be `Sync`
(as they're not stored in an `Arc`). Instead they just need to be `Send +
'static` as one might otherwise expect.

Along the way this also refactors a few pieces here and there to make more sense
in this new scheme. The `ReadinessStream` type now has a type parameter
indicating an owned reference to the I/O object it wraps. This can be accessed
via the `get_ref` and `get_mut` methods. Additionally I/O tokens on the event
loop are now a full-fledged `IoToken` type which we can change in the future if
we need to.
2016-08-20 23:07:00 -07:00
David Renshaw
5ab323e5c2 Revert to using futures::lazy(), which is in fact needed. 2016-08-20 16:22:54 -04:00
David Renshaw
a9b53d61d2 update comment and simplify echo example 2016-08-20 11:52:16 -04:00
Alex Crichton
0a707ffccb Update docs of futures-mio 2016-08-18 10:29:11 -07:00
Alex Crichton
12a05b9568 Rewrite recursion with a loop in sink.rs 2016-08-18 09:19:50 -07:00
Alex Crichton
32eb457dad Relax the 'static bound on Loop::run
We know that the future will never persist beyond this stack frame, so we can
just leave its ownership on the stack frame itself and receive notifications off
the event loop that we need to poll it.
2016-08-17 23:34:44 -07:00
Alex Crichton
9672f90091 Remove lots of 'static bounds
The core trait and associated types no longer require the `'static` bounds, and
all associated methods have also had the `'static` bounds removed. The only
location for the `'static` bound is `forget`.

While the restriction of `'static` on `forget` is here to stay, we'll soon
enable `Loop::run` to take a non-`'static` future, allowing driving a
non-`'static` future.
2016-08-17 18:48:21 -07:00
Alex Crichton
8025d85019 Update futures-curl
Also involved yet another round of bug fixes to the timer wheel as well as an
unfortunately serious rejiggering of the level-translation into libcurl. Eew.
2016-08-17 18:41:34 -07:00
Alex Crichton
311bfa07a3 Update futures-minihttp 2016-08-17 18:41:34 -07:00
Alex Crichton
d0b911189c Re-work I/O
* Auto-register interest whenever we see WouldBlock
* Remove implementations of `Stream<Item=Ready>`, no longer needed
* Add explicit `poll_{read,write}` methods, if needed
* Remove all I/O streams, libstd ones suffice
* Update all I/O futures
2016-08-17 18:41:34 -07:00
Alex Crichton
293d104177 Remove Future::schedule
A more appealing model is actually just automatically inferring what needs to be
scheduled based on what actions are done during poll. For example if during a
poll you check a oneshot channel, then the current task is registered for being
woken up if it's not ready. Similarly this will apply to I/O where if I/O is
attempted but we see EAGAIN then we'll schedule the task to get notified when
it's ready.

This may also have performance benefits in some niche situations because you
don't need to recompute where you are in the state machine both during poll and
during schedule. Instead, it now happens all at once.
2016-08-17 18:41:34 -07:00
Alex Crichton
62f306629d Keep polling in Buffered if there's more futures
We're not NotReady until we hit the final future and it's not done.
2016-08-15 16:22:09 -07:00
Alex Crichton
217af868e1 Implement UDS bindings
Closes #61
2016-08-15 10:31:23 -07:00
Alex Crichton
8327d327c1 Optimize next_timeout slightly
Avoid moves as it apparently adversely affects perf
2016-08-13 23:29:08 -07:00
Alex Crichton
3158a2c73b Add a method to get a handle from a pin
It's store there anyway!
2016-08-13 23:13:26 -07:00
Alex Crichton
b508964db6 Remove Send from Future/Stream
This bound existed for two primary reasons, both detail below, and both of which
have now been solved.

One of the primary reasons this existed was due to the presence of `tailcall`.
Each standard combinator will call `tailcall` as appropriate, storing the
resulting trait object. Storing trait objects influences the applicatoin of the
`Send` and `Sync` bounds normally, but a key insight here is that we're not
storing trait objects but rather just pieces of otherwise internal futures.

With this insight the main storage for these futures, `Collapsed`, could simply
implement `Send` so long as the future itself originally implemented `Send`.
This in turn means that `tailcall` must be an `unsafe` method, but it seems well
worth the benefit of relaxing the `Send` bound.

The second primary reason for this bound was so the `Task` itself could be send.
This is critical for ensuring that futures can receive notifications from
multiple threads (e.g. be a future waiting on sources of multiple events).
Another key insight here, however, is that only the *outer* future needs to be
`Send`. We already have a solution, with `LoopData`, to make non-`Send` data
`Send`. By implementing `Future` directly for `LoopData<F: Future>`, this means
that it's trivial to make any future sendable by simply pinning it to an event
loop!

With these two pieces combined, it means that `Send` is no longer needed as a
bound on the `Future` and `Stream` traits. It may practically mean that
`LoopData` is used commonly in some scenarios, but that's quite a small price to
pay for relaxing the requirements of the core trait.

Some other ramifications of this change are:

* The `Future::boxed` and `Stream::boxed` methods now require `Self` to adhere
  to `Send`. This is expected to be the most common case, and in the less common
  case of not-`Send` `Box::new` can be used.
* Two new type aliases, `BoxFuture` and `BoxStream` have been introduced to
  assist in writing APIs that return a trait object which is `Send`. Both of
  these type aliases package in the `Send` bound.
* A new `LoopPin` type, added in the previous commit, can be used to easily
  generate handles that can be used to pin futures to an event loop without
  having a literal reference to the event loop itself.
2016-08-12 15:39:41 -07:00
Alex Crichton
9911f421eb Add LoopPin to easily create LoopData 2016-08-12 13:42:24 -07:00
Alex Crichton
ef3efd4175 Remove the Any bound from LoopData
No need for this, all we need is 'static now
2016-08-12 11:15:34 -07:00
Yale Cason III
0aa7ab94ff Listening vs Listenering
Not trying to be pedantic, just noticed this.
2016-08-11 14:46:16 -04:00
Alex Crichton
f08e8ec672 Fix compile on windows 2016-08-10 22:33:45 -07:00
Alex Crichton
18c371b158 Remove extraneous allocation on ReadinessStream::new 2016-08-10 13:58:20 -07:00
Alex Crichton
517d5c7434 Add libcurl bindings 2016-08-09 23:51:14 -07:00
Alex Crichton
7c4bac5166 Fix a few more timer wheel bugs 2016-08-09 22:13:50 -07:00
Alex Crichton
681316dfa1 Fix link in mio README 2016-08-08 23:20:05 -07:00
Alex Crichton
00daa2ca23 Add lots of README files 2016-08-08 23:18:49 -07:00
Alex Crichton
68103727f1 Use the dev branch of mio 2016-08-08 13:22:16 -07:00
Alex Crichton
bfe91f9f36 Remove the executable bit on a file 2016-08-08 11:44:16 -07:00
Alex Crichton
8d73133907 write-then-drop is now upstream 2016-08-08 11:00:04 -07:00
Alex Crichton
4380e42587 More info and more READMEs 2016-08-05 16:21:56 -07:00