diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3ff8f33..9293f55 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,13 +23,18 @@ jobs: tests: name: Tests - runs-on: ubuntu-latest strategy: matrix: - rust: - - stable - - nightly - - 1.57.0 + # test all Rust versions on Ubuntu + rust: [stable, 1.57.0] + os: [ubuntu-latest, m] + # test stable Rust on Windows and MacOS as well + include: + - rust: stable + os: windows-latest + - rust: stable + os: macos-latest + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - name: Install toolchain diff --git a/src/wait.rs b/src/wait.rs index f19b064..e154f99 100644 --- a/src/wait.rs +++ b/src/wait.rs @@ -19,7 +19,6 @@ //! [`core::task::Waker`]s, for the async MPSC, or [`std::thread::Thread`]s, for //! the blocking MPSC. In either case, the role played by these types is fairly //! analogous. -use crate::util::panic::UnwindSafe; use core::{fmt, task::Waker}; mod cell; @@ -54,7 +53,7 @@ pub(crate) enum WaitResult { Notified, } -pub(crate) trait Notify: UnwindSafe + fmt::Debug + Clone { +pub(crate) trait Notify: fmt::Debug + Clone { fn notify(self); fn same(&self, other: &Self) -> bool; diff --git a/src/wait/cell.rs b/src/wait/cell.rs index 53ba117..e01d4dc 100644 --- a/src/wait/cell.rs +++ b/src/wait/cell.rs @@ -99,7 +99,10 @@ impl WaitCell { let result = match test_dbg!(self.compare_exchange(State::PARKING, State::WAITING, AcqRel)) { Ok(_) => { - let _ = panic::catch_unwind(move || drop(prev_waiter)); + // XXX(eliza): it's kind of sad we have to use + // `AssertUnwindSafe` here, because `std::thread::Thread` + // contains a `Condvar` on macOS :( + let _ = panic::catch_unwind(panic::AssertUnwindSafe(move || drop(prev_waiter))); WaitResult::Wait } @@ -117,9 +120,11 @@ impl WaitCell { ); if let Some(prev_waiter) = prev_waiter { - let _ = panic::catch_unwind(move || { + // XXX(eliza): similarly, it's necessary to assert unwind + // safety due to `std::thread::Thread` on macOS here... + let _ = panic::catch_unwind(panic::AssertUnwindSafe(move || { prev_waiter.notify(); - }); + })); } if let Some(waiter) = waiter {