File tree 2 files changed +7
-3
lines changed
src/Sentry.Unity/Integrations
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Unreleased
4
4
5
+ ### Fixes
6
+
7
+ - Fixed a potential race condition in the ANR watchdog integration ([ 2045] ( https://github.com/getsentry/sentry-unity/pull/2045 ) )
8
+
5
9
### Dependencies
6
10
7
11
- Bump .NET SDK from v5.1.1 to v5.2.0 ([ #2040 ] ( https://github.com/getsentry/sentry-unity/pull/2040 ) )
Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ private IEnumerator UpdateUiStatus()
126
126
yield return waitForSeconds ;
127
127
while ( ! _stop )
128
128
{
129
- _ticksSinceUiUpdate = 0 ;
129
+ Interlocked . Exchange ( ref _ticksSinceUiUpdate , 0 ) ;
130
130
_reported = false ;
131
131
yield return waitForSeconds ;
132
132
}
@@ -144,12 +144,12 @@ private void Run()
144
144
145
145
while ( ! _stop )
146
146
{
147
- _ticksSinceUiUpdate ++ ;
147
+ Interlocked . Increment ( ref _ticksSinceUiUpdate ) ;
148
148
Thread . Sleep ( SleepIntervalMs ) ;
149
149
150
150
if ( Paused )
151
151
{
152
- _ticksSinceUiUpdate = 0 ;
152
+ Interlocked . Exchange ( ref _ticksSinceUiUpdate , 0 ) ;
153
153
}
154
154
else if ( _ticksSinceUiUpdate >= reportThreshold && ! _reported )
155
155
{
You can’t perform that action at this time.
0 commit comments