Un thread se termine lorsque sa méthode run() retourne normalement ou lève une exception non gérée. Le moyen sûr d'arrêter un thread en externe consiste à utiliser le mécanisme d'interruption : interruption() définit un indicateur, et le thread lui-même doit vérifier cet indicateur et quitter.

Le mécanisme d’interruption
Full content is available with a subscription.
Get full access to all courses on the platform for one year with a single payment.
Unlike other platforms that charge per course, here you get everything for one price, and after one year of use there will be no automatic charge for the following year.