Commit Graph

8 Commits

Author SHA1 Message Date
Laurențiu Nicola
04a78badc5 Implement Debug for JsFuture 2019-04-20 09:41:59 +03:00
Nick Fitzgerald
e20c4067dc futures: Add a test for creating multiple futures from the same promise 2019-02-04 16:38:21 +01:00
lcnr/Bastian Kauschke
6e08f579a6 add temporary test 2019-01-14 21:04:29 +01:00
Richard Dodd
c849ef3cf4 Add naive spawn_local implementation + tests
This is just a naive implementation. It seems it can be improved using a
custom task queue, but that can be in a separate PR.
2019-01-05 14:34:50 +00:00
Alex Crichton
48f4adfa8c Run rustfmt over everything 2018-11-27 12:07:59 -08:00
Alex Crichton
a1da85a24b Defer future execution to the next event loop tick
Previously whenever a future readiness notification came in we would
immediately start polling a future. This ends up having two downsides,
however:

* First, the stack depth may run a risk of getting blown. There's no
  recursion limit to defer execution to later, which means that if
  futures are always ready we'll keep making the stack deeper.

* Second, and more worrisome in the near term, apparently future
  adapaters in the `futures` crate (namely the unsync oneshot channel)
  doesn't actually work if you immediately poll on readiness. This may
  or may not be a bug in the `futures` crate but it's good to fix it
  here anyway.

As a result whenever a future is ready to get polled again we defer its
polling to the next turn of the event loop. This should ensure that the
current call stack is always drained and we're effectively enqueueing
the future to be polled in the near future.
2018-10-23 07:12:54 -07:00
Alex Crichton
d4297ad2d3 Remove use_extern_macros features
This has now been stabilized!
2018-08-19 14:33:01 -07:00
Nick Fitzgerald
ff83594882 futures: Add sanity tests for conversion between Promises and Futures
Part of #614
2018-08-09 16:21:49 -07:00