Skip to content

Commit

Permalink
Only panic in send when debug_assertions are enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
faern committed Mar 20, 2019
1 parent 3996e3e commit 8844366
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions core/src/thread_parker/sgx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,14 @@ impl UnparkHandle {
// released to avoid blocking the queue for too long.
#[inline]
pub fn unpark(self) {
if let Err(error) = usercalls::send(EV_UNPARK, Some(self.0)) {
if error.kind() != io::ErrorKind::InvalidInput {
panic!("send returned an unexpected error: {:?}", error);
let result = usercalls::send(EV_UNPARK, Some(self.0));
if cfg!(debug_assertions) {
if let Err(error) = result {
// `InvalidInput` may be returned if the thread we send to has
// already been unparked and exited.
if error.kind() != io::ErrorKind::InvalidInput {
panic!("send returned an unexpected error: {:?}", error);
}
}
}
}
Expand Down

0 comments on commit 8844366

Please sign in to comment.