-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tmp/tokio 1.0 #28
base: master
Are you sure you want to change the base?
Tmp/tokio 1.0 #28
Conversation
let flag = Arc::new(AtomicBool::new(false)); | ||
let flag_cp = flag.clone(); | ||
let fut_listen_03 = async move { | ||
let listener = tokio::net::TcpListener::bind(addr).await.unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
このファイルが提供している struct とかをテストしてるわけじゃなさそうなんですけど, このテストはここにあったほうが良いのでしょうか?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
確かにそうなのですが、他に適切な置き場所もなく、という感じです。
let mut future = futures::failed::<(), ()>(()).timeout_after(Duration::from_secs(1)); | ||
assert_eq!(future.poll(), Err(Some(()))); | ||
let mut exec = ThreadPoolExecutor::new().unwrap(); | ||
// 直接 timeout を呼ぶと動かず、and_then の中で呼ぶと動く。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
確かにそのようです.
thread 'time::timer::test::it_works' panicked at 'there is no reactor running, must be called from the context of a Tokio 1.x runtime', /home/tmiyashita/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.1.1/src/runtime/context.rs:37:26
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Ok(Async::Ready())
が戻るのが分かったり出来たら良かったんですけど, 難しそうですね
} | ||
|
||
/// Runs infinitely until an error happens. | ||
fn run(self) -> io::Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
サポートできないなら fibers-rs のメジャーバージョンを変更し、このメソッドも API から削除してしまってはどうでしょう。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
そうします。よく考えたらいずれにせよ、io, net, fiber::schedule モジュールは消してしまうので、メジャーバージョンの更新は必須でした。
lib.rs から mod io, mod net, mod fiber::schedule を削除し、利用者が io, net, fiber::schedule を利用できないようにしました。(io と net は fibers 経由で利用させることができないため、fiber::schedule は tokio のスケジューラと競合するため) |
No description provided.