@@ -376,12 +376,6 @@ force_done(ThreadHandle *handle)
376
376
return 0 ;
377
377
}
378
378
379
- static void
380
- start_failed (ThreadHandle * handle )
381
- {
382
- _PyOnceFlag_CallOnce (& handle -> once , (_Py_once_fn_t * )force_done , handle );
383
- }
384
-
385
379
static int
386
380
ThreadHandle_start (ThreadHandle * self , PyObject * func , PyObject * args ,
387
381
PyObject * kwargs )
@@ -405,8 +399,7 @@ ThreadHandle_start(ThreadHandle *self, PyObject *func, PyObject *args,
405
399
struct bootstate * boot = PyMem_RawMalloc (sizeof (struct bootstate ));
406
400
if (boot == NULL ) {
407
401
PyErr_NoMemory ();
408
- start_failed (self );
409
- return -1 ;
402
+ goto start_failed ;
410
403
}
411
404
PyInterpreterState * interp = _PyInterpreterState_GET ();
412
405
boot -> tstate = _PyThreadState_New (interp , _PyThreadState_WHENCE_THREADING );
@@ -415,8 +408,7 @@ ThreadHandle_start(ThreadHandle *self, PyObject *func, PyObject *args,
415
408
if (!PyErr_Occurred ()) {
416
409
PyErr_NoMemory ();
417
410
}
418
- start_failed (self );
419
- return -1 ;
411
+ goto start_failed ;
420
412
}
421
413
boot -> func = Py_NewRef (func );
422
414
boot -> args = Py_NewRef (args );
@@ -430,9 +422,8 @@ ThreadHandle_start(ThreadHandle *self, PyObject *func, PyObject *args,
430
422
if (PyThread_start_joinable_thread (thread_run , boot , & ident , & os_handle )) {
431
423
PyThreadState_Clear (boot -> tstate );
432
424
thread_bootstate_free (boot , 1 );
433
- start_failed (self );
434
425
PyErr_SetString (ThreadError , "can't start new thread" );
435
- return -1 ;
426
+ goto start_failed ;
436
427
}
437
428
438
429
// Mark the handle running
@@ -448,6 +439,10 @@ ThreadHandle_start(ThreadHandle *self, PyObject *func, PyObject *args,
448
439
_PyEvent_Notify (& boot -> handle_ready );
449
440
450
441
return 0 ;
442
+
443
+ start_failed :
444
+ _PyOnceFlag_CallOnce (& self -> once , (_Py_once_fn_t * )force_done , self );
445
+ return -1 ;
451
446
}
452
447
453
448
static int
0 commit comments