@@ -9,8 +9,10 @@ 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
13- loop._debug_cb_handles_count += 1
12+ system.__atomic_fetch_add(
13+ & loop._debug_cb_handles_total, 1 , system.__ATOMIC_RELAXED)
14+ system.__atomic_fetch_add(
15+ & loop._debug_cb_handles_count, 1 , system.__ATOMIC_RELAXED)
1416 if loop._debug:
1517 self ._source_traceback = extract_stack()
1618
@@ -21,7 +23,8 @@ cdef class Handle:
2123
2224 def __dealloc__ (self ):
2325 if UVLOOP_DEBUG and self .loop is not None :
24- self .loop._debug_cb_handles_count -= 1
26+ system.__atomic_fetch_sub(
27+ & self .loop._debug_cb_handles_count, 1 , system.__ATOMIC_RELAXED)
2528 if self .loop is None :
2629 raise RuntimeError (' Handle.loop is None in Handle.__dealloc__' )
2730
@@ -174,8 +177,10 @@ cdef class TimerHandle:
174177 self ._cancelled = 0
175178
176179 if UVLOOP_DEBUG:
177- self .loop._debug_cb_timer_handles_total += 1
178- 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)
179184
180185 if context is None :
181186 context = Context_CopyCurrent()
@@ -205,7 +210,8 @@ cdef class TimerHandle:
205210
206211 def __dealloc__ (self ):
207212 if UVLOOP_DEBUG:
208- 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)
209215 if self .timer is not None :
210216 raise RuntimeError (' active TimerHandle is deallacating' )
211217
0 commit comments