Skip to content
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

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft

Tmp/tokio 1.0 #28

wants to merge 17 commits into from

Conversation

koba-e964
Copy link
Member

No description provided.

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();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このファイルが提供している struct とかをテストしてるわけじゃなさそうなんですけど, このテストはここにあったほうが良いのでしょうか?

Copy link
Member Author

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 の中で呼ぶと動く。
Copy link

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<()> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

サポートできないなら fibers-rs のメジャーバージョンを変更し、このメソッドも API から削除してしまってはどうでしょう。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

そうします。よく考えたらいずれにせよ、io, net, fiber::schedule モジュールは消してしまうので、メジャーバージョンの更新は必須でした。

@koba-e964
Copy link
Member Author

koba-e964 commented Mar 22, 2021

lib.rs から mod io, mod net, mod fiber::schedule を削除し、利用者が io, net, fiber::schedule を利用できないようにしました。(io と net は fibers 経由で利用させることができないため、fiber::schedule は tokio のスケジューラと競合するため)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants