Home›Planet GNOME›Article

Jussi Pakkanen: Implementing a simple version of ThreadPoolExecutor in Pystd

Jussi Pakkanen · Oct 15, 2026

AI summary AI-generated, may contain mistakes

The author implemented a simplified version of Python's ThreadPoolExecutor in Pystd, enabling parallel execution of tasks such as image file conversion, though it does not yet support futures for return values. The implementation required building fundamental components like threads, mutexes, and condition variables, after which the core logic proved simple enough to write by hand in a single afternoon. The example code, including PNG processing with libpng, is available in the pngtest branch.

One of my favourite things in the Python standard library is the ThreadPoolExecutor. It is a very simple way to run a bunch of tasks in parallel, such as converting or repacking a whole bunch of image files from one format to another. You write a pure function that takes two arguments, the input and output file names, and does the conversion. Then you submit a bunch of tasks (basically function and argument pairs) and the executor runs them with maximal parallelism.

I decided to implement this in Pystd. To make things simpler it does not yet support futures for return values. Writing a thread pool executor needs some fundamental building blocks such as threads, mutexes and condition variables. Once those were implemented (and working), writing the actual "business logic" turned out to be fairly simple. In fact, it took less time than writing the PNG processing code with libpng.

First you need to write this helper class to register you task for running. It also stores all arguments etc that the task needs to do its thing. Yes, this has a bit of that "icky 90s Java" feeling to it but OTOH it is fairly simple, has unambiguous ownership semantics and compiles massively faster than your typical template monstrosity.

Keep reading

Out of respect for the author only the opening is shown here. Read the rest on the original site, or in HorizonReader with highlights, notes and AI help.

More from Planet GNOME

Thibault Martin: I realized that Multimodal embed models are what AI should be about

AI summaryMistral has released Clipstral, a multimodal embedding model that can process text, images, and video (but not audio), sorting all inputs into a shared 'library' based on similarity regardless of format—for example, placing a photo of a macaw flapping its wings next to the text 'a red bird flapping its wings'. Unlike chatbots such as ChatGPT or Claude, it isn't a model you talk to directly; developers must build applications around it, with Mistral suggesting use cases like monitoring robotic operations, detecting manufacturing defects, and diagnosing crop illnesses. Notably, the model is also not English-centric.

GIMP: Development Update - Shape Tool

AI summaryA GIMP contributor announces the implementation of a long-requested Shape tool, now available in the 3.3 development branch, which lets users draw lines, rectangles, ellipses, polygons, stars, and spirals directly on the canvas as vector layers or on raster layers. The post traces the feature's 25-year history, from the first community request in 2001 through the creation of vector layers via a 2006 Google Summer of Code project, and details the technical process behind building the tool. Future improvements include support for custom shapes and a dedicated Shape layer with editable parameters, and users can try the tool now via development builds.

Thibault Martin: I realized that An email, calendar, and contacts all-in-one engine is exciting, actually

AI summaryThe author, a Linux user who misses Apple's well-integrated Mail, Calendar, and Contacts apps, discusses Pimalaya, an NLnet-funded PIM engine offering separate email, calendar, and contacts engines that share a common, portable SQLite-based store and run on all major operating systems. With its recent first stable release, Pimalaya handles the difficult low-level work, freeing developers to focus on building polished, platform-integrated apps similar to Apple's PIM suite. The author is optimistic about what this means for the future of email, contacts, and calendar clients.

This Week in GNOME: #276 Enhanced Lifelines

AI summaryThis Week in GNOME #276 recaps project news from November 20 to 27, highlighting the release of Gaphor 3.4.0 with new features such as actors on lifelines, along with third-party app updates including word-sys's PDF Editor v1.12.1, Rewaita v1.1.8c adding window blur support, Vinyl v1.7.0, and RustConn 0.26.5 with session sharing and script recording. It also announces GirCore 0.9.0-preview.2 with GNOME 51 and .NET 11 support, plus shell extension updates like Now Playing Card's new Ribbon spectrum shape and Simple Pleasures, a new fork of Essential Tweaks offering various UI and behavior tweaks.

Thibault Martin: TIL that Fermi's paradox could be explained by policies

AI summaryThe author discusses a paper proposing a solution to Fermi's paradox: as civilizations grow, their energy consumption outpaces innovation, causing them to either collapse or deliberately slow down for stability, which prevents them from ever spreading across the galaxy and explains why we detect no alien life. He appreciates that the paper puts policy at the center of explaining hypothetical alien behavior. He also criticizes the paper's convoluted title and abstract as a typical example of the obscure academic writing style described in Steven Pinker's The Sense of Style.