Skip to content

Commit

Permalink
Replace dropped atomic with termination atomic
Browse files Browse the repository at this point in the history
  • Loading branch information
MolotovCherry committed Oct 13, 2023
1 parent 49a8524 commit 8a1adab
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions virtual-display-driver/src/swap_chain_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ pub struct SwapChainProcessor {
available_buffer_event: HANDLE,
terminate_event: AtomicBool,
thread: Mutex<Option<JoinHandle<()>>>,
dropped: AtomicBool,
}

unsafe impl Send for SwapChainProcessor {}
Expand All @@ -49,7 +48,6 @@ impl SwapChainProcessor {
available_buffer_event: new_frame_event,
terminate_event: AtomicBool::new(false),
thread: Mutex::new(None),
dropped: AtomicBool::new(false),
})
}

Expand Down Expand Up @@ -152,10 +150,8 @@ impl SwapChainProcessor {

/// Terminate swap chain if it hasn't already been
pub fn terminate(&self) {
let dropped = self.dropped.load(Ordering::Relaxed);
if !dropped {
self.dropped.store(true, Ordering::Relaxed);

let terminated = self.terminate_event.load(Ordering::Relaxed);
if !terminated {
// send signal to end thread
self.terminate_event.store(true, Ordering::Relaxed);

Expand Down

0 comments on commit 8a1adab

Please sign in to comment.