@@ -30,19 +30,19 @@ public async Task ExplicitPublishMode()
3030#pragma warning restore CS0618
3131 await UntilConditionAsync (
3232 TimeSpan . FromSeconds ( 10 ) ,
33- ( ) => Thread . VolatileRead ( ref b ) == 1
34- && Thread . VolatileRead ( ref c ) == 1
35- && Thread . VolatileRead ( ref d ) == 1 ) ;
36- Assert . Equal ( 0 , Thread . VolatileRead ( ref a ) ) ;
37- Assert . Equal ( 1 , Thread . VolatileRead ( ref b ) ) ;
38- Assert . Equal ( 1 , Thread . VolatileRead ( ref c ) ) ;
39- Assert . Equal ( 1 , Thread . VolatileRead ( ref d ) ) ;
33+ ( ) => Volatile . Read ( ref b ) == 1
34+ && Volatile . Read ( ref c ) == 1
35+ && Volatile . Read ( ref d ) == 1 ) ;
36+ Assert . Equal ( 0 , Volatile . Read ( ref a ) ) ;
37+ Assert . Equal ( 1 , Volatile . Read ( ref b ) ) ;
38+ Assert . Equal ( 1 , Volatile . Read ( ref c ) ) ;
39+ Assert . Equal ( 1 , Volatile . Read ( ref d ) ) ;
4040
4141#pragma warning disable CS0618
4242 pub . Publish ( "*bcd" , "efg" ) ;
4343#pragma warning restore CS0618
44- await UntilConditionAsync ( TimeSpan . FromSeconds ( 10 ) , ( ) => Thread . VolatileRead ( ref a ) == 1 ) ;
45- Assert . Equal ( 1 , Thread . VolatileRead ( ref a ) ) ;
44+ await UntilConditionAsync ( TimeSpan . FromSeconds ( 10 ) , ( ) => Volatile . Read ( ref a ) == 1 ) ;
45+ Assert . Equal ( 1 , Volatile . Read ( ref a ) ) ;
4646 }
4747
4848 [ Theory ]
@@ -86,7 +86,7 @@ public async Task TestBasicPubSub(string? channelPrefix, bool wildCard, string b
8686 {
8787 Assert . Empty ( received ) ;
8888 }
89- Assert . Equal ( 0 , Thread . VolatileRead ( ref secondHandler ) ) ;
89+ Assert . Equal ( 0 , Volatile . Read ( ref secondHandler ) ) ;
9090#pragma warning disable CS0618
9191 var count = sub . Publish ( pubChannel , "def" ) ;
9292#pragma warning restore CS0618
@@ -99,8 +99,8 @@ public async Task TestBasicPubSub(string? channelPrefix, bool wildCard, string b
9999 Assert . Single ( received ) ;
100100 }
101101 // Give handler firing a moment
102- await UntilConditionAsync ( TimeSpan . FromSeconds ( 2 ) , ( ) => Thread . VolatileRead ( ref secondHandler ) == 1 ) ;
103- Assert . Equal ( 1 , Thread . VolatileRead ( ref secondHandler ) ) ;
102+ await UntilConditionAsync ( TimeSpan . FromSeconds ( 2 ) , ( ) => Volatile . Read ( ref secondHandler ) == 1 ) ;
103+ Assert . Equal ( 1 , Volatile . Read ( ref secondHandler ) ) ;
104104
105105 // unsubscribe from first; should still see second
106106#pragma warning disable CS0618
@@ -113,9 +113,9 @@ public async Task TestBasicPubSub(string? channelPrefix, bool wildCard, string b
113113 Assert . Single ( received ) ;
114114 }
115115
116- await UntilConditionAsync ( TimeSpan . FromSeconds ( 2 ) , ( ) => Thread . VolatileRead ( ref secondHandler ) == 2 ) ;
116+ await UntilConditionAsync ( TimeSpan . FromSeconds ( 2 ) , ( ) => Volatile . Read ( ref secondHandler ) == 2 ) ;
117117
118- var secondHandlerCount = Thread . VolatileRead ( ref secondHandler ) ;
118+ var secondHandlerCount = Volatile . Read ( ref secondHandler ) ;
119119 Log ( "Expecting 2 from second handler, got: " + secondHandlerCount ) ;
120120 Assert . Equal ( 2 , secondHandlerCount ) ;
121121 Assert . Equal ( 1 , count ) ;
@@ -130,7 +130,7 @@ public async Task TestBasicPubSub(string? channelPrefix, bool wildCard, string b
130130 {
131131 Assert . Single ( received ) ;
132132 }
133- secondHandlerCount = Thread . VolatileRead ( ref secondHandler ) ;
133+ secondHandlerCount = Volatile . Read ( ref secondHandler ) ;
134134 Log ( "Expecting 2 from second handler, got: " + secondHandlerCount ) ;
135135 Assert . Equal ( 2 , secondHandlerCount ) ;
136136 Assert . Equal ( 0 , count ) ;
@@ -170,7 +170,7 @@ public async Task TestBasicPubSubFireAndForget()
170170 {
171171 Assert . Empty ( received ) ;
172172 }
173- Assert . Equal ( 0 , Thread . VolatileRead ( ref secondHandler ) ) ;
173+ Assert . Equal ( 0 , Volatile . Read ( ref secondHandler ) ) ;
174174 await PingAsync ( pub , sub ) . ForAwait ( ) ;
175175 var count = sub . Publish ( key , "def" , CommandFlags . FireAndForget ) ;
176176 await PingAsync ( pub , sub ) . ForAwait ( ) ;
@@ -182,7 +182,7 @@ public async Task TestBasicPubSubFireAndForget()
182182 {
183183 Assert . Single ( received ) ;
184184 }
185- Assert . Equal ( 1 , Thread . VolatileRead ( ref secondHandler ) ) ;
185+ Assert . Equal ( 1 , Volatile . Read ( ref secondHandler ) ) ;
186186
187187 sub . Unsubscribe ( key ) ;
188188 count = sub . Publish ( key , "ghi" , CommandFlags . FireAndForget ) ;
@@ -241,7 +241,7 @@ public async Task TestPatternPubSub()
241241 {
242242 Assert . Empty ( received ) ;
243243 }
244- Assert . Equal ( 0 , Thread . VolatileRead ( ref secondHandler ) ) ;
244+ Assert . Equal ( 0 , Volatile . Read ( ref secondHandler ) ) ;
245245
246246 await PingAsync ( pub , sub ) . ForAwait ( ) ;
247247 var count = sub . Publish ( RedisChannel . Literal ( "abc" ) , "def" ) ;
@@ -254,8 +254,8 @@ public async Task TestPatternPubSub()
254254 }
255255
256256 // Give reception a bit, the handler could be delayed under load
257- await UntilConditionAsync ( TimeSpan . FromSeconds ( 2 ) , ( ) => Thread . VolatileRead ( ref secondHandler ) == 1 ) ;
258- Assert . Equal ( 1 , Thread . VolatileRead ( ref secondHandler ) ) ;
257+ await UntilConditionAsync ( TimeSpan . FromSeconds ( 2 ) , ( ) => Volatile . Read ( ref secondHandler ) == 1 ) ;
258+ Assert . Equal ( 1 , Volatile . Read ( ref secondHandler ) ) ;
259259
260260#pragma warning disable CS0618
261261 sub . Unsubscribe ( "a*c" ) ;
0 commit comments