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 79a4cd3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions applications/test_task_cancel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
extern crate alloc;

use alloc::{string::String, sync::Arc, vec::Vec};
<<<<<<< HEAD
use core::sync::atomic::{AtomicBool, AtomicUsize, Ordering::Relaxed};
=======
use core::sync::atomic::{AtomicBool, Ordering::Relaxed};
>>>>>>> test-task-cancellation
use spin::Mutex;

pub fn main(_: Vec<String>) -> isize {
Expand Down Expand Up @@ -42,14 +46,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 79a4cd3

Please sign in to comment.