@@ -140,7 +140,7 @@ typedef struct {
140140
141141 PyMutex mutex ;
142142
143- PyEvent thread_is_bootstrapped ;
143+ PyEvent thread_is_running ;
144144 // Set immediately before `thread_run` returns to indicate that the OS
145145 // thread is about to exit. This is used to avoid false positives when
146146 // detecting self-join attempts. See the comment in `ThreadHandle_join()`
@@ -233,7 +233,7 @@ ThreadHandle_new(void)
233233 self -> os_handle = 0 ;
234234 self -> has_os_handle = 0 ;
235235 self -> thread_is_exiting = (PyEvent ){0 };
236- self -> thread_is_bootstrapped = (PyEvent ){0 };
236+ self -> thread_is_running = (PyEvent ){0 };
237237 self -> mutex = (PyMutex ){_Py_UNLOCKED };
238238 self -> once = (_PyOnceFlag ){0 };
239239 self -> state = THREAD_HANDLE_NOT_STARTED ;
@@ -326,7 +326,7 @@ _PyThread_AfterFork(struct _pythread_runtime_state *state)
326326 handle -> once = (_PyOnceFlag ){_Py_ONCE_INITIALIZED };
327327 handle -> mutex = (PyMutex ){_Py_UNLOCKED };
328328 _PyEvent_Notify (& handle -> thread_is_exiting );
329- _PyEvent_Notify (& handle -> thread_is_bootstrapped );
329+ _PyEvent_Notify (& handle -> thread_is_running );
330330 llist_remove (node );
331331 remove_from_shutdown_handles (handle );
332332 }
@@ -400,7 +400,7 @@ thread_run(void *boot_raw)
400400 }
401401 // Notify that bootstrap is done and failed (e.g. Memory error).
402402 set_thread_handle_state (handle , THREAD_HANDLE_FAILED );
403- _PyEvent_Notify (& handle -> thread_is_bootstrapped );
403+ _PyEvent_Notify (& handle -> thread_is_running );
404404 }
405405 else {
406406 Py_DECREF (res );
@@ -719,10 +719,10 @@ PyThreadHandleObject_join(PyObject *op, PyObject *args)
719719}
720720
721721static PyObject *
722- PyThreadHandleObject_is_bootstrapped (PyObject * op , PyObject * Py_UNUSED (dummy ))
722+ PyThreadHandleObject_is_running (PyObject * op , PyObject * Py_UNUSED (dummy ))
723723{
724724 PyThreadHandleObject * self = PyThreadHandleObject_CAST (op );
725- if (_PyEvent_IsSet (& self -> handle -> thread_is_bootstrapped )) {
725+ if (_PyEvent_IsSet (& self -> handle -> thread_is_running )) {
726726 Py_RETURN_TRUE ;
727727 }
728728 else {
@@ -731,33 +731,26 @@ PyThreadHandleObject_is_bootstrapped(PyObject *op, PyObject *Py_UNUSED(dummy))
731731}
732732
733733static PyObject *
734- PyThreadHandleObject_wait_bootstrapped (PyObject * op , PyObject * Py_UNUSED (dummy ))
734+ PyThreadHandleObject_wait_running (PyObject * op , PyObject * Py_UNUSED (dummy ))
735735{
736736 PyThreadHandleObject * self = PyThreadHandleObject_CAST (op );
737- PyEvent_Wait (& self -> handle -> thread_is_bootstrapped );
738- Py_RETURN_NONE ;
737+ PyEvent_Wait (& self -> handle -> thread_is_running );
738+ if (get_thread_handle_state (self -> handle ) == THREAD_HANDLE_FAILED ) {
739+ Py_RETURN_FALSE ;
740+ }
741+ else {
742+ Py_RETURN_TRUE ;
743+ }
739744}
740745
741746static PyObject *
742- PyThreadHandleObject_set_bootstrapped (PyObject * op , PyObject * Py_UNUSED (dummy ))
747+ PyThreadHandleObject_set_running (PyObject * op , PyObject * Py_UNUSED (dummy ))
743748{
744749 PyThreadHandleObject * self = PyThreadHandleObject_CAST (op );
745- _PyEvent_Notify (& self -> handle -> thread_is_bootstrapped );
750+ _PyEvent_Notify (& self -> handle -> thread_is_running );
746751 Py_RETURN_NONE ;
747752}
748753
749- static PyObject *
750- PyThreadHandleObject_is_failed (PyObject * op , PyObject * Py_UNUSED (dummy ))
751- {
752- PyThreadHandleObject * self = PyThreadHandleObject_CAST (op );
753- if (get_thread_handle_state (self -> handle ) == THREAD_HANDLE_FAILED ) {
754- Py_RETURN_TRUE ;
755- }
756- else {
757- Py_RETURN_FALSE ;
758- }
759- }
760-
761754static PyObject *
762755PyThreadHandleObject_is_done (PyObject * op , PyObject * Py_UNUSED (dummy ))
763756{
@@ -791,10 +784,9 @@ static PyGetSetDef ThreadHandle_getsetlist[] = {
791784static PyMethodDef ThreadHandle_methods [] = {
792785 {"join" , PyThreadHandleObject_join , METH_VARARGS , NULL },
793786 {"_set_done" , PyThreadHandleObject_set_done , METH_NOARGS , NULL },
794- {"wait_bootstrapped" , PyThreadHandleObject_wait_bootstrapped , METH_NOARGS , NULL },
795- {"set_bootstrapped" , PyThreadHandleObject_set_bootstrapped , METH_NOARGS , NULL },
796- {"is_bootstrapped" , PyThreadHandleObject_is_bootstrapped , METH_NOARGS , NULL },
797- {"is_failed" , PyThreadHandleObject_is_failed , METH_NOARGS , NULL },
787+ {"wait_running" , PyThreadHandleObject_wait_running , METH_NOARGS , NULL },
788+ {"set_running" , PyThreadHandleObject_set_running , METH_NOARGS , NULL },
789+ {"is_running" , PyThreadHandleObject_is_running , METH_NOARGS , NULL },
798790 {"is_done" , PyThreadHandleObject_is_done , METH_NOARGS , NULL },
799791 {0 , 0 }
800792};
@@ -2522,7 +2514,7 @@ thread__make_thread_handle(PyObject *module, PyObject *identobj)
25222514 hobj -> handle -> ident = ident ;
25232515 hobj -> handle -> state = THREAD_HANDLE_RUNNING ;
25242516 PyMutex_Unlock (& hobj -> handle -> mutex );
2525- _PyEvent_Notify (& hobj -> handle -> thread_is_bootstrapped );
2517+ _PyEvent_Notify (& hobj -> handle -> thread_is_running );
25262518 return (PyObject * ) hobj ;
25272519}
25282520
0 commit comments