Ensure context canceller takes a reference
This commit is contained in:
parent
3ffd194a05
commit
adff751a7e
1 changed files with 2 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Canceller {
|
||||
/// A reference to the canceled value of a context.
|
||||
cancelled: Arc<AtomicBool>,
|
||||
|
@ -14,7 +15,7 @@ impl Canceller {
|
|||
}
|
||||
}
|
||||
// Cancel the context.
|
||||
pub fn cancel(self) {
|
||||
pub fn cancel(&self) {
|
||||
self.cancelled.store(true, Ordering::SeqCst);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue