We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
thread_park_ok
1 parent 933fa49 commit 99a03a5Copy full SHA for 99a03a5
tokio/tests/rt_handle_block_on.rs
@@ -220,6 +220,24 @@ rt_test! {
220
assert_eq!(answer, 42);
221
}
222
223
+ #[test]
224
+ fn thread_park_ok() {
225
+ use core::task::Poll;
226
+ let rt = rt();
227
+ let mut exit = false;
228
+ rt.handle().block_on(core::future::poll_fn(move |cx| {
229
+ if exit {
230
+ return Poll::Ready(());
231
+ }
232
+ cx.waker().wake_by_ref();
233
+ // Verify that consuming the park token does not result in a hang.
234
+ std::thread::current().unpark();
235
+ std::thread::park();
236
+ exit = true;
237
+ Poll::Pending
238
+ }));
239
240
+
241
// ==== net ======
242
243
#[test]
0 commit comments