Commit c78d199 1 parent e7a6dc1 commit c78d199 Copy full SHA for c78d199
File tree 1 file changed +13
-6
lines changed
1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ impl State {
80
80
Snapshot ( self . 0 . load ( Acquire ) )
81
81
}
82
82
83
+ #[ allow( dead_code) ]
83
84
pub ( crate ) fn store ( & self , val : Snapshot ) {
84
85
self . 0 . store ( val. 0 , Release ) ;
85
86
}
@@ -156,12 +157,18 @@ impl State {
156
157
/// Optimistically tries to swap the state assuming the join handle is
157
158
/// __immediately__ dropped on spawn
158
159
pub ( super ) fn drop_join_handle_fast ( & self ) -> Result < ( ) , ( ) > {
159
- if * self . load ( ) == INITIAL_STATE {
160
- self . store ( Snapshot ( ( INITIAL_STATE - REF_ONE ) & !JOIN_INTEREST ) ) ;
161
- trace ! ( "MONOIO DEBUG[State]: drop_join_handle_fast" ) ;
162
- Ok ( ( ) )
163
- } else {
164
- Err ( ( ) )
160
+ match self . fetch_update ( |curr| {
161
+ if * curr == INITIAL_STATE {
162
+ Some ( Snapshot ( ( INITIAL_STATE - REF_ONE ) & !JOIN_INTEREST ) )
163
+ } else {
164
+ None
165
+ }
166
+ } ) {
167
+ Ok ( _) => {
168
+ trace ! ( "MONOIO DEBUG[State]: drop_join_handle_fast" ) ;
169
+ Ok ( ( ) )
170
+ }
171
+ Err ( _) => Err ( ( ) ) ,
165
172
}
166
173
}
167
174
You can’t perform that action at this time.
0 commit comments