Commit Graph

4 Commits

Author SHA1 Message Date
Jun Wu
ea60810732 async-runtime: support multi-thread block_on_future
Summary:
This would have been easier if we can upgrade tokio (D24011447).
For now, let's just solve it by using a channel so the mutex is not held for long.

The implementation has some side effects, though:
- panic message is not preserved.
- 'static lifetime is required on Future.

The `'static` lifetime is incompatible with some existing code. The old function
is preserved as `block_on_exclusive` and is used in places where a future does
not have `'static` lifetime.

Reviewed By: sfilipco

Differential Revision: D24033134

fbshipit-source-id: 7b35d1ff636d2a289db9b04e60419c31bdea9453
2020-09-30 20:31:34 -07:00
Jun Wu
3c5c6bf5af async-runtime: add iter_to_stream
Summary: `iter_to_stream` converts a blocking iterator to a stream.

Reviewed By: sfilipco

Differential Revision: D24033135

fbshipit-source-id: da5b1f8e6768124ef7c915e1bb17216fde00a55a
2020-09-30 20:16:40 -07:00
David Tolnay
e62b176170 Prepare for rustfmt 2.0
Summary:
Generated by formatting with rustfmt 2.0.0-rc.2 and then a second time with fbsource's current rustfmt (1.4.14).

This results in formatting for which rustfmt 1.4 is idempotent but is closer to the style of rustfmt 2.0, reducing the amount of code that will need to change atomically in that upgrade.

 ---

*Why now?* **:** The 1.x branch is no longer being developed and fixes like https://github.com/rust-lang/rustfmt/issues/4159 (which we need in fbcode) only land to the 2.0 branch.

 ---

Reviewed By: zertosh

Differential Revision: D23568779

fbshipit-source-id: 477200f35b280a4f6471d8e574e37e5f57917baf
2020-09-07 20:47:59 -07:00
Stefan Filip
72db1cbedb async-runtime: crate for async job scheduling from blocking threads
Summary:
We have a thread blocking application. We have async libraries. This crate
provides common utilities for communicating between the blocking world and the
async world. It is intended to be a guide so that not all developers have to
get in depth understanding of Tokio in order to use async functions.

Reviewed By: quark-zju, xavierd

Differential Revision: D23222876

fbshipit-source-id: b9a61795bc917bfc664c9d6da95c9e5e2d506c79
2020-08-26 00:57:32 -07:00