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):
192192 self .capture_func (envelope )
193193
194194 # hygiene: deterministically clean up any stopping thread
195- if not self ._thread_stopping ():
195+ if not self ._should_join_thread ():
196196 return
197197 with self ._thread_lock :
198- if not self ._thread_stopping ():
198+ if not self ._should_join_thread ():
199199 return
200200 if self ._thread : # typing
201201 self ._thread .join ()
202202 self ._thread = None
203203 self ._thread_for_pid = None
204204
205- def _thread_stopping (self ):
205+ def _should_join_thread (self ):
206206 # type: (...) -> bool
207207 return (
208- not self ._running
208+ not self .__shutdown_requested . is_set ()
209209 and self ._thread is not None
210210 # we are the parent thread:
211211 and self ._thread_for_pid == os .getpid ()
@@ -217,8 +217,8 @@ def _ensure_running(self):
217217 Check that we have an active thread to run in, or create one if not.
218218
219219 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.
222222 """
223223 if self ._thread_for_pid == os .getpid () and self ._thread is not None :
224224 return None
You can’t perform that action at this time.
0 commit comments