current-thread: make tokio_current_thread::Handle Sync (#1119)

This commit is contained in:
Reto Kaiser
2019-07-08 10:25:34 -07:00
committed by Carl Lerche
parent b62d224fac
commit 7797a377c3
3 changed files with 32 additions and 15 deletions
@@ -750,6 +750,25 @@ fn spawn_from_executor_with_handle() {
current_thread.block_on(rx).unwrap();
}
#[test]
fn handle_status() {
let current_thread = CurrentThread::new();
let handle = current_thread.handle();
assert!(handle.status().is_ok());
drop(current_thread);
assert!(handle.spawn(async { () }).is_err());
assert!(handle.status().is_err());
}
#[test]
fn handle_is_sync() {
let current_thread = CurrentThread::new();
let handle = current_thread.handle();
let _box: Box<dyn Sync> = Box::new(handle);
}
async fn yield_once() {
YieldOnce(false).await
}