File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -3488,22 +3488,26 @@ wait_for_interp_references(PyInterpreterState *interp)
34883488 }
34893489 PyMutex_Unlock (& finalizing -> mutex );
34903490
3491- PyTime_t wait_ns = 1000 * 1000 ; // 1 millisecond
3491+ PyTime_t wait_max = 1000 * 1000 * 100 ; // 100 milliseconds
3492+ PyTime_t wait_ns = 1000 ; // 1 microsecond
34923493
34933494 while (true) {
34943495 if (PyEvent_WaitTimed (& finalizing -> finished , wait_ns , 1 )) {
34953496 // Event set
34963497 break ;
34973498 }
34983499
3500+ wait_ns *= 2 ;
3501+ wait_ns = Py_MIN (wait_ns , wait_max );
3502+
34993503 if (PyErr_CheckSignals ()) {
35003504 PyErr_Print ();
3501- // The user CTRL+C'd us, bail out without waiting for a reference
3502- // count of zero.
3503- //
3504- // This will probably cause threads to crash, but maybe that's
3505- // better than a deadlock. It might be worth intentionally
3506- // leaking subinterpreters to prevent some crashes here.
3505+ /* The user CTRL+C'd us, bail out without waiting for a reference
3506+ count of zero.
3507+
3508+ This will probably cause threads to crash, but maybe that's
3509+ better than a deadlock. It might be worth intentionally
3510+ leaking subinterpreters to prevent some crashes here. */
35073511 break ;
35083512 }
35093513 }
You can’t perform that action at this time.
0 commit comments