File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
src/BootstrapBlazor/Services Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ internal class DefaultDispatchService<TEntry> : IDispatchService<TEntry>
99{
1010 public void Dispatch ( DispatchEntry < TEntry > payload )
1111 {
12- lock ( locker )
12+ lock ( _locker )
1313 {
1414 Cache . ForEach ( cb =>
1515 {
@@ -20,21 +20,25 @@ public void Dispatch(DispatchEntry<TEntry> payload)
2020
2121 public void Subscribe ( Func < DispatchEntry < TEntry > , Task > callback )
2222 {
23- lock ( locker )
23+ lock ( _locker )
2424 {
2525 Cache . Add ( callback ) ;
2626 }
2727 }
2828
2929 public void UnSubscribe ( Func < DispatchEntry < TEntry > , Task > callback )
3030 {
31- lock ( locker )
31+ lock ( _locker )
3232 {
3333 Cache . Remove ( callback ) ;
3434 }
3535 }
3636
3737 private List < Func < DispatchEntry < TEntry > , Task > > Cache { get ; } = new ( 50 ) ;
3838
39- private readonly object locker = new ( ) ;
39+ #if NET9_0_OR_GREATER
40+ private readonly Lock _locker = new ( ) ;
41+ #else
42+ private readonly object _locker = new ( ) ;
43+ #endif
4044}
You can’t perform that action at this time.
0 commit comments