File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -192,20 +192,20 @@ def flush(self):
192
192
self .capture_func (envelope )
193
193
194
194
# hygiene: deterministically clean up any stopping thread
195
- if not self ._thread_stopping ():
195
+ if not self ._should_join_thread ():
196
196
return
197
197
with self ._thread_lock :
198
- if not self ._thread_stopping ():
198
+ if not self ._should_join_thread ():
199
199
return
200
200
if self ._thread : # typing
201
201
self ._thread .join ()
202
202
self ._thread = None
203
203
self ._thread_for_pid = None
204
204
205
- def _thread_stopping (self ):
205
+ def _should_join_thread (self ):
206
206
# type: (...) -> bool
207
207
return (
208
- not self ._running
208
+ not self .__shutdown_requested . is_set ()
209
209
and self ._thread is not None
210
210
# we are the parent thread:
211
211
and self ._thread_for_pid == os .getpid ()
@@ -217,8 +217,8 @@ def _ensure_running(self):
217
217
Check that we have an active thread to run in, or create one if not.
218
218
219
219
Note that this might fail (e.g. in Python 3.12 it's not possible to
220
- spawn new threads at interpreter shutdown). In that case self._running
221
- will be False after running this function.
220
+ spawn new threads at interpreter shutdown). In that case
221
+ `__shutdown_requested` will be set after running this function.
222
222
"""
223
223
if self ._thread_for_pid == os .getpid () and self ._thread is not None :
224
224
return None
You can’t perform that action at this time.
0 commit comments