Questions tagged [qtconcurrent]

QtConcurrent is a Qt framework namespace providing high-level multithreading APIs.

QtConcurrent namespace was introduced in Qt 4.4. The QtConcurrent namespace provides high-level APIs that make it possible to write multi-threaded programs without using low-level threading primitives such as mutexes, read-write locks, wait conditions, or semaphores.

As of Qt 4.8.0, it includes:

  • 2 Classes
  • 2 Types
  • and mostly Functions

As of Qt 5, it became a separate add-on module, and includes:

  • QtConcurrent namespace
  • QFuture
  • QFutureIterator
  • QFutureWatcher
  • QFutureSynchronizer

Details can be found on the following page.

Resources:

193 questions
0
votes
1 answer

Set list of QFutures to QFutureWatcher

Is it possible to add multiple QFuture's to QFutureWatcher? I wanted to add multiple features to QFutureWatcher and get notified when all the threads finished. QFutureSynchronizer did not help me as it dont have a signal to finished
NDestiny
  • 1,133
  • 1
  • 12
  • 28
0
votes
0 answers

Qfuture consists of null pointer

My Qt multi-threaded program crashes when it reaches : if(QFutureVar.isRunning()) I tried try-catch block, but that didn't work. How can I check if it's null? When I step-into my code in that line, debugger tells me: Signal name:…
Hesam
  • 105
  • 6
0
votes
0 answers

no matching function for call to object map(*it);

I am trying to make a call to a function multiple times but parallelize them using QtConcurrent::mapped But I am not able to over come the error: error: no matching function for call to object of type 'addWrapper' *result = map(*it); …
ejoshva
  • 41
  • 2
0
votes
1 answer

Use QWaitCondition in a thread started by QtConcurrent

i have a function that is started by a QTconcurrent run. Inside this function i use QThread (To get the Thread created by the QTConcurrent run) static method to sleep it for some time, but i don't want anymore to use time to activate it, i'd like to…
Harald Hoerwick
  • 132
  • 1
  • 1
  • 8
0
votes
1 answer

QtConcurrent number of arguments error

I have a QMainWindow class. class MainWindow: public QMainWindow { Q_OBJECT ... public: void insertVector(); ... }; and I have class SqlStorage to make operation with Data Base. class SqlStorage : public QObject { Q_OBJECT …
koch_kir
  • 163
  • 17
0
votes
1 answer

Using QtConcurrent for singletons

I'm making use of thread-safe QObject singletons in my own project and I was wondering whether I'm doing right in creating them using QtConcurrent rather than QMutex'es and QThread's. Here is how I'm managing to write singleton code. class A :…
alediaferia
  • 2,537
  • 19
  • 22
0
votes
1 answer

How to take address of non-static member function to use within QtConcurrent?

I'm trying to run non-static member function in the other thread. If I go: void *(PortManager::*innerAskPtr)() = &this->innerAsk; QFuture f = QtConcurrent::run(innerAskPtr); it prompts that ISO C++ forbids taking the adress of an…
smsware
  • 429
  • 1
  • 13
  • 41
0
votes
1 answer

exception generated with qtconcurrent and calling QTime:currentTime

I seem to be getting an exception generated only with a thread created with Qtconcurrent::run I have a class named FPSengine which has a method named FPSengine::getData() that is called by the main thread and 3 other threads (2 QThreads and 1 made…
yan bellavance
  • 4,710
  • 20
  • 62
  • 93
0
votes
1 answer

Qt Programming - QtConcurrence kill thread

I use a QtConcurrence to run a function in a separated thread but I want to stop, pause or kill this thread but I can't. I read this: Note that the QFuture returned by QtConcurrent::run() does not support canceling, pausing, or progress…
amurcia
  • 801
  • 10
  • 26
0
votes
2 answers

Cancel QtConcurent computation

I would like to cancel a QtConcurent::map computation at an event. This is my test code (the computation is represented by an infinite loop) : class Test : public QObject { Q_OBJECT public: Test(QObject *parent=0) : QObject(parent){} …
saad
  • 764
  • 4
  • 18
0
votes
2 answers

Large number of simultaneous long-running operations in Qt

I have some long-running operations that number in the hundreds. At the moment they are each on their own thread. My main goal in using threads is not to speed these operations up. The more important thing in this case is that they appear to run…
0
votes
2 answers

QtConcurrent error: reference to non-static member

I am running Qt 5.1 and QtQuick 2.0 on a Mac with OS-X 10.8.4. My Qt-QML GUI becomes unresponsive because I am blocking the event loop with file I/O operations. The usual approach to solving it is to use multiple threads as discussed HERE by Will…
Bruce Dean
  • 2,798
  • 2
  • 18
  • 30
0
votes
1 answer

Set default stack size for future QThreadPool threads and/or pthread_create calls

I'm using QtConcurrent/QThreadPool and it is creating threads with a stack-size that is too small on Mac OS X 10.8 (512kB) but fine on CentOS 5.9 (10MB). I'm hoping there is a workaround where I can set some process-wide default for new threads'…
SimonD
  • 638
  • 5
  • 16
0
votes
2 answers

How to control (i.e. abort) the current evaluation of a QScriptEngine

I evaluate JavaScript in my Qt application using QScriptEngine::evaluate(QString code). Let's say I evaluate a buggy piece of JavaScript which loops forever (or takes too long to wait for the result). How can I abort such an execution? I want to…
leemes
  • 44,967
  • 21
  • 135
  • 183
0
votes
1 answer

Issue on closing/aborting QProgressDialog

I'm now adding GUI to a project original written for console operation. I chosen Qt as the framework and now facing difficulty in handling close event of QProgressDialog. Issue 1: I used QtConcurrent::run to fork a process for a long/heavy task, and…
YamHon.CHAN
  • 866
  • 4
  • 20
  • 36
1 2 3
12
13