Skip to content

Commit 8844366

Browse files
committed
Only panic in send when debug_assertions are enabled
1 parent 3996e3e commit 8844366

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

core/src/thread_parker/sgx.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,14 @@ impl UnparkHandle {
8989
// released to avoid blocking the queue for too long.
9090
#[inline]
9191
pub fn unpark(self) {
92-
if let Err(error) = usercalls::send(EV_UNPARK, Some(self.0)) {
93-
if error.kind() != io::ErrorKind::InvalidInput {
94-
panic!("send returned an unexpected error: {:?}", error);
92+
let result = usercalls::send(EV_UNPARK, Some(self.0));
93+
if cfg!(debug_assertions) {
94+
if let Err(error) = result {
95+
// `InvalidInput` may be returned if the thread we send to has
96+
// already been unparked and exited.
97+
if error.kind() != io::ErrorKind::InvalidInput {
98+
panic!("send returned an unexpected error: {:?}", error);
99+
}
95100
}
96101
}
97102
}

0 commit comments

Comments
 (0)