Skip to content

Commit 7f491d2

Browse files
Thomasdezeeuwcramertj
authored andcommitted
Add AwokenCount.get
1 parent 8a7f4c3 commit 7f491d2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

futures-test/src/task/wake_counter.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,16 @@ pub struct AwokenCount {
1010
inner: Arc<WakerInner>,
1111
}
1212

13+
impl AwokenCount {
14+
/// Get the current count.
15+
fn get(&self) -> usize {
16+
self.inner.count.load(Ordering::SeqCst)
17+
}
18+
}
19+
1320
impl PartialEq<usize> for AwokenCount {
1421
fn eq(&self, other: &usize) -> bool {
15-
self.inner.count.load(Ordering::SeqCst) == *other
22+
self.get() == *other
1623
}
1724
}
1825

0 commit comments

Comments
 (0)