Zum Inhalt springen

Thread without join (ARCH2041)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Key python.async.thread-without-join · Severity warning · Category async

When a thread is created and started with no corresponding join(), the spawning scope may exit before the thread finishes and the thread’s exceptions vanish unobserved.

import threading
def process(items):
t = threading.Thread(target=work, args=(items,))
t.start() # no join, work unobserved
import threading
def process(items):
t = threading.Thread(target=work, args=(items,))
t.start()
t.join() # wait for completion

Call join() for every thread you start, or manage daemon lifetimes explicitly.