[Interest] Executing a small function as a thread
Syam Krishnan
syamcr at gmail.com
Tue Mar 17 16:06:22 CET 2015
On 03/17/2015 08:03 PM, André Somers wrote:
> Might I suggest a third method? Use QtConcurrent::run(yourFunction)
> instead.
The documentation on QtConcurrent::run() says
"Note that the function may not run immediately; the function will only
be run when a thread is available."
That is not acceptable to me. I am looking for the simplest solution
that has the least overhead.
And I should have mentioned that only one instance of do_something()
must be executing at any time.
I am using QAtomicInt to control calls to this function. So when a
second event is raised, it will check if
the thread is already executing. If it is, it will wait till the thread
execution is complete.
And I'm using Qt 4.8 on Linux.
Syam
More information about the Interest
mailing list