[Qt-interest] concurrent-run of a static function
K. Frank
kfrank29.c at gmail.com
Sun May 16 17:36:20 CEST 2010
Gabriele -
It's not clear to me what you are asking.
On Sat, May 15, 2010 at 10:21 PM, Gabriele Kahlout
<gabriele at mysimpatico.com> wrote:
> Is it not possible?
>
> 2010/5/14 Gabriele Kahlout <gabriele at mysimpatico.com>
>>
>> The documentation shows how to execute async. a member or helper function.
>> What about a static function, can it also be executed async.? If so how?
"Execute async."? I suppose you mean execute a function asynchronously, by
which I suppose you mean execute a function in another thread.
The next question is "static function". I suppose this could either
mean a static
member function of a class, or a free function (that is, a function
that is not a
member of a class). These two cases are basically the same.
It is possible to execute both a free function and a static member function from
a thread -- you just call it.
E.g.
int returnZero { return 0; } // free function
class A {
public:
static int returnOne() { return 1; }
};
class B : public QThread {
public:
void run() {
int i = getZero();
int j = A::getOne();
}
};
// some code...
B *b = new B;
b->start(); // this will call getZero() and getOne() in the new thread
(Of course, this example doesn't really do much, but you get the idea...)
If you are asking something different (that is, asking not about
simply executing
a function from a thread), then you will have to elaborate so we can understand
what you're looking for.
>> Regards,
>> K. Gabriele
Good luck.
>> --- unchanged since 25/1/10 ---
>> P.S. Unless a notification (LON), please reply either with an answer OR
>> with " ACK" appended to this subject within 48 hours. Otherwise, I might
>> ...
(Is there some way you could turn off "ACK" message? It would help clean
up the list traffic a little if you could. Thanks.)
K. Frank
More information about the Qt-interest-old
mailing list