File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -28,10 +28,14 @@ impl Flag {
28
28
} ) )
29
29
}
30
30
31
- pub fn signal ( & self ) {
31
+ pub fn notify ( & self ) {
32
32
self . 0 . set . store ( true , Ordering :: Relaxed ) ;
33
33
self . 0 . waker . wake ( ) ;
34
34
}
35
+
36
+ pub fn notified ( & self ) -> bool {
37
+ self . 0 . set . load ( Ordering :: Relaxed )
38
+ }
35
39
}
36
40
37
41
impl Future for Flag {
@@ -79,6 +83,11 @@ impl Event {
79
83
EventHandle :: new ( self . flag . clone ( ) )
80
84
}
81
85
86
+ /// Get if the event has been notified.
87
+ pub fn notified ( & self ) -> bool {
88
+ self . flag . notified ( )
89
+ }
90
+
82
91
/// Wait for [`EventHandle::notify`] called.
83
92
pub async fn wait ( self ) {
84
93
self . flag . await
@@ -97,6 +106,6 @@ impl EventHandle {
97
106
98
107
/// Notify the event.
99
108
pub fn notify ( self ) {
100
- self . flag . signal ( )
109
+ self . flag . notify ( )
101
110
}
102
111
}
You can’t perform that action at this time.
0 commit comments