We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent af005ef commit 31175f9Copy full SHA for 31175f9
1 file changed
sdks/python/apache_beam/runners/worker/statesampler_fast.pyx
@@ -153,9 +153,14 @@ cdef class StateSampler(object):
153
self.sampling_thread.join()
154
155
def reset(self):
156
- for state in self.scoped_states_by_index:
157
- (<ScopedState>state)._nsecs = 0
158
- self.started = self.finished = False
+ with nogil:
+ pythread.PyThread_acquire_lock(self.lock, pythread.WAIT_LOCK)
+ try:
159
+ for state in self.scoped_states_by_index:
160
+ (<ScopedState>state)._nsecs = 0
161
+ self.started = self.finished = False
162
+ finally:
163
+ pythread.PyThread_release_lock(self.lock)
164
165
cpdef ScopedState current_state(self):
166
return self.current_state_c()
0 commit comments