mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-20 00:00:08 +02:00
task: mark JoinHandle as UnwindSafe (#4418)
This commit is contained in:
@@ -3,6 +3,7 @@ use crate::runtime::task::RawTask;
|
||||
use std::fmt;
|
||||
use std::future::Future;
|
||||
use std::marker::PhantomData;
|
||||
use std::panic::{RefUnwindSafe, UnwindSafe};
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
|
||||
@@ -150,6 +151,9 @@ cfg_rt! {
|
||||
unsafe impl<T: Send> Send for JoinHandle<T> {}
|
||||
unsafe impl<T: Send> Sync for JoinHandle<T> {}
|
||||
|
||||
impl<T> UnwindSafe for JoinHandle<T> {}
|
||||
impl<T> RefUnwindSafe for JoinHandle<T> {}
|
||||
|
||||
impl<T> JoinHandle<T> {
|
||||
pub(super) fn new(raw: RawTask) -> JoinHandle<T> {
|
||||
JoinHandle {
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
|
||||
use std::panic::{RefUnwindSafe, UnwindSafe};
|
||||
|
||||
#[test]
|
||||
fn join_handle_is_unwind_safe() {
|
||||
is_unwind_safe::<tokio::task::JoinHandle<()>>();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn net_types_are_unwind_safe() {
|
||||
is_unwind_safe::<tokio::net::TcpListener>();
|
||||
Reference in New Issue
Block a user