File tree 1 file changed +6
-6
lines changed
projects/RabbitMQ.Client/client/impl
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ namespace RabbitMQ.Client.client.impl
39
39
sealed class AsyncManualResetEvent : IValueTaskSource
40
40
{
41
41
private ManualResetValueTaskSourceCore < bool > _valueTaskSource ;
42
- private volatile bool _isSet ;
42
+ private bool _isSet ;
43
43
44
44
public AsyncManualResetEvent ( bool initialState = false )
45
45
{
@@ -51,7 +51,7 @@ public AsyncManualResetEvent(bool initialState = false)
51
51
}
52
52
}
53
53
54
- public bool IsSet => _isSet ;
54
+ public bool IsSet => Volatile . Read ( ref _isSet ) ;
55
55
56
56
public async ValueTask WaitAsync ( CancellationToken cancellationToken )
57
57
{
@@ -97,23 +97,23 @@ await tokenRegistration.DisposeAsync()
97
97
98
98
public void Set ( )
99
99
{
100
- if ( _isSet )
100
+ if ( IsSet )
101
101
{
102
102
return ;
103
103
}
104
104
105
- _isSet = true ;
105
+ Volatile . Write ( ref _isSet , true ) ;
106
106
_valueTaskSource . SetResult ( true ) ;
107
107
}
108
108
109
109
public void Reset ( )
110
110
{
111
- if ( ! _isSet )
111
+ if ( ! IsSet )
112
112
{
113
113
return ;
114
114
}
115
115
116
- _isSet = false ;
116
+ Volatile . Write ( ref _isSet , false ) ;
117
117
_valueTaskSource . Reset ( ) ;
118
118
}
119
119
You can’t perform that action at this time.
0 commit comments