Tag Archives: Threads

Python Concurrency: An Intro to Threads

Python has a number of different concurrency constructs such as threading, queues and multiprocessing. The threading module used to be the primary way of accomplishing concurrency. A few years ago, the multiprocessing module was added to the Python suite of standard libraries. This article will be focused on the threading module though. Continue reading Python Concurrency: An Intro to Threads

Python Concurrency: An Example of a Queue

Python comes with a lot of cool concurrency tools builtin, such as threads, Queues, semaphores and multiprocessing. In this article, we’ll spend some time learning how to use Queues. A Queue can be used for first-in-first out or last-in-last-out stack-like implementations if you just use them directly. If you’d like to see that in action, see the Hellman article at the end of this post. We’re going to mix threads in and create a simple file downloader script to demonstrate how Queues work for cases where we want concurrency. Continue reading Python Concurrency: An Example of a Queue

wxPython and Threads

If you use GUIs in Python much, then you know that sometimes you need to execute some long running process every now and then. Of course, if you do that as you would with a command line program, then you’ll be in for a surprise. In most cases, you’ll end up blocking your GUI’s event loop and the user will see your program freeze. What can you do to get around just mishaps? Start the task in another thread or process of course! In this article, we’ll look at how to do this with wxPython and Python’s threading module. Continue reading wxPython and Threads