thread.timeout_ms, 0);
if (st == PY_LOCK_ACQUIRED) {
/* Cancelled by user */
- PyThread_release_lock(thread.cancel_event);
break;
}
/* Timeout => dump traceback */
} while (ok && thread.repeat);
/* The only way out */
- thread.running = 0;
+ PyThread_release_lock(thread.cancel_event);
PyThread_release_lock(thread.join_event);
+ thread.running = 0;
}
static void
if (thread.running) {
/* Notify cancellation */
PyThread_release_lock(thread.cancel_event);
- /* Wait for thread to join */
- PyThread_acquire_lock(thread.join_event, 1);
- assert(thread.running == 0);
- PyThread_release_lock(thread.join_event);
}
+ /* Wait for thread to join */
+ PyThread_acquire_lock(thread.join_event, 1);
+ assert(thread.running == 0);
+ PyThread_release_lock(thread.join_event);
Py_CLEAR(thread.file);
}