The Thread class¶
-
class
click_threading.
Thread
(*args, **kwargs)¶ A thread that automatically pushes the parent thread’s context in the new thread.
Since version 5.0, click maintains global stacks of context objects. The topmost context on that stack can be accessed with
get_current_context()
.There is one stack for each Python thread. That means if you are in the main thread (where you can use
get_current_context()
just fine) and spawn athreading.Thread
, that thread won’t be able to access the same context usingget_current_context()
.Thread
is a subclass ofthreading.Thread
that preserves the current thread context when spawning a new one, by pushing it on the stack of the new thread as well.