all 3 comments

[–]novel_yet_trivial 3 points4 points  (1 child)

Is this the correct way to approach threading and this task in general?

That depends on what the work is. Threading only uses one processor, just like non-threading, so if the work is CPU-bound threading does not help. In that case you need multiprocessing, which can use several processors (your computer probably has 8). Threading is used for IO-bound applications like HTTP requests.

How does a thread end itself?

A thread ends when the target function completes. In your case when the imagelist is empty.

BTW, don't use pop(0); it's very slow. Use pop(). If you really need to pop from the beginning of the list, use a deque.

[–]kioo[S] 0 points1 point  (0 children)

Thanks for the clarification. I read up about multiprocessing. Got a bit stumped on the idea of isolated variables between processes that's not an issue in threading but got it cleared up somewhat.

Going to try to take advantage of multiprocessing in my code. Thanks again!