mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-28 00:00:11 +02:00
current-thread: make tokio_current_thread::Handle Sync (#1119)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user