0

I have never tried multi-threaded programming in Python. I am trying to achieve the following:

From my main thread, I want to spawn a child thread which downloads data in the background.

I have multiple data download tasks, for example, task1, task2, task3, ... These tasks are triggered by events in the main application. I want to queue these tasks in the background to be performed sequentially in a separate thread. Also if any task (for example task1) is done or already in queue then don't schedule it in the queue.

Can someone help provide a sample code snippet on how to achieve this.

Rahul
  • 755
  • 4
  • 8
  • 16
  • Consider using [a `Queue`](https://docs.python.org/2/library/queue.html). – Thomas Orozco Jul 03 '15 at 16:42
  • Welcome to Stack Overflow! I've edited your question. I think it's a bit broad though; you could improve your question with sample code that you have already tried. It may also be relevant to add which version of Python you are using; off the top of my head it makes a difference. – S.L. Barth is on codidact.com Jul 05 '15 at 16:41

0 Answers0