Back to Blog home

Introducing Qt Concurrent

Published on Friday February 23, 2007 by admin in Labs Qt Concurrent Threads | Comments

As a part of Trolltech Labs, I'm adding the Qt Concurrent project. Qt Concurrent is a high-level threading framework for writing code that automatically scales on multi-core systems.

For example, to make thumbnails of a list of images you can do this:

QImage scaled(const QImage &image)
{
return image.scaled(QSize(100, 100));
}

...

const QList<QImage> images = ...
const QList<QImage> thumbnails = QtConcurrent::mapped(images, scaled);

QtConcurrent::mapped() runs scaled() on each image in the list, using as many threads as there are CPU cores on the system.

In addition to this Qt Concurrent also provides a MapReduce implementation for shared-memory systems and support for making asynchronous function calls using futures.

You can get the source code at the labs pages, and there is also a forum for questions and general feedback.

Subscribe to Our Blog

Stay up to date with the latest marketing, sales and service tips and news.

The blog comment system has been migrated to a new platform. If you face any issues, please let us know via feedback@qt.io.