Skip to content

how to call thread.join() #33

@kf89

Description

@kf89

From your code I have seen that you call thread.join after calling thread.start() and inside the same loop.But from here you can see that the idiomatic way is to call thread.join in another loop.
for t in ts: t.join()
is generally the idiomatic way to start a small number of threads. Doing .join means that your main thread waits until the given thread finishes before proceeding in execution. You generally do this after you've started all of the threads.

I have used both ways, and it's strange that the program with idiomatic way of using thread.join() takes more execution time than yours.But maybe it is better in memory consumption which i haven't tested yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions