Skip to content

Commit

Permalink
Merge branch 'test-task-cancellation' into task-cancel
Browse files Browse the repository at this point in the history
Signed-off-by: Klim Tsoutsman <[email protected]>
  • Loading branch information
tsoutsman committed Dec 26, 2022
2 parents 074688b + 4edd99f commit 08d0140
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions applications/test_task_cancel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
extern crate alloc;

use alloc::{string::String, sync::Arc, vec::Vec};
use core::sync::atomic::{AtomicBool, AtomicUsize, Ordering::Relaxed};
use core::sync::atomic::{AtomicBool, Ordering::Relaxed};
use spin::Mutex;

pub fn main(_: Vec<String>) -> isize {
Expand Down Expand Up @@ -42,14 +42,12 @@ fn guard_hog(lock: Arc<Mutex<()>>) {
#[inline(never)]
fn lsda_generator() {
static FALSE: AtomicBool = AtomicBool::new(false);
static __COUNTER: AtomicUsize = AtomicUsize::new(0);

// We need to give LLVM false hope that unwind_row_generator may unwind.
// Otherwise, LLVM will generate an unwind row, but no LSDA for guard_holder.
// We need to give LLVM false hope that lsda_generator may unwind. Otherwise,
// LLVM will generate an unwind row, but no LSDA for guard_holder.
//
// The potential panic also prevents lsda_generator from being optimised away.
if FALSE.load(Relaxed) {
panic!();
}

// Prevents unwind_row_generator from being optimised away.
__COUNTER.fetch_add(1, Relaxed);
}

0 comments on commit 08d0140

Please sign in to comment.