Thread overview | |||||
---|---|---|---|---|---|
|
November 07, 2016 Thread (spawn) for object's method | ||||
---|---|---|---|---|
| ||||
Is there a way to make new thread for class method? E.g. I have some class and I need to run one of them method in new thread. I found wxamples only with function... |
November 08, 2016 Re: Thread (spawn) for object's method | ||||
---|---|---|---|---|
| ||||
Posted in reply to Konstantin Kutsevalov | On Monday, 7 November 2016 at 16:15:44 UTC, Konstantin Kutsevalov wrote:
> Is there a way to make new thread for class method?
>
> E.g. I have some class and I need to run one of them method in new thread.
>
> I found wxamples only with function...
import core.thread;
class Foo
{
void method(){}
}
void main()
{
Foo foo = new Foo;
Thread t = new Thread(&foo.method);
}
|
November 08, 2016 Re: Thread (spawn) for object's method | ||||
---|---|---|---|---|
| ||||
Posted in reply to Basile B. | On Tuesday, 8 November 2016 at 06:40:32 UTC, Basile B. wrote:
> On Monday, 7 November 2016 at 16:15:44 UTC, Konstantin Kutsevalov wrote:
>> Is there a way to make new thread for class method?
>>
>> E.g. I have some class and I need to run one of them method in new thread.
>>
>> I found wxamples only with function...
>
>
> import core.thread;
>
> class Foo
> {
> void method(){}
> }
>
> void main()
> {
> Foo foo = new Foo;
> Thread t = new Thread(&foo.method);
> }
oh, so simple... :) thank you!
|
Copyright © 1999-2021 by the D Language Foundation