Skip to content

Commit 4d56638

Browse files
committed
Also apply on timer handles
1 parent 39111e9 commit 4d56638

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

uvloop/cbhandles.pyx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ cdef class Handle:
99
cdef inline _set_loop(self, Loop loop):
1010
self.loop = loop
1111
if UVLOOP_DEBUG:
12-
loop._debug_cb_handles_total += 1
12+
system.__atomic_fetch_add(
13+
&loop._debug_cb_handles_total, 1, system.__ATOMIC_RELAXED)
1314
system.__atomic_fetch_add(
1415
&loop._debug_cb_handles_count, 1, system.__ATOMIC_RELAXED)
1516
if loop._debug:
@@ -176,8 +177,10 @@ cdef class TimerHandle:
176177
self._cancelled = 0
177178

178179
if UVLOOP_DEBUG:
179-
self.loop._debug_cb_timer_handles_total += 1
180-
self.loop._debug_cb_timer_handles_count += 1
180+
system.__atomic_fetch_add(
181+
&self.loop._debug_cb_timer_handles_total, 1, system.__ATOMIC_RELAXED)
182+
system.__atomic_fetch_add(
183+
&self.loop._debug_cb_timer_handles_count, 1, system.__ATOMIC_RELAXED)
181184

182185
if context is None:
183186
context = Context_CopyCurrent()
@@ -207,7 +210,8 @@ cdef class TimerHandle:
207210

208211
def __dealloc__(self):
209212
if UVLOOP_DEBUG:
210-
self.loop._debug_cb_timer_handles_count -= 1
213+
system.__atomic_fetch_sub(
214+
&self.loop._debug_cb_timer_handles_count, 1, system.__ATOMIC_RELAXED)
211215
if self.timer is not None:
212216
raise RuntimeError('active TimerHandle is deallacating')
213217

0 commit comments

Comments
 (0)