| Thread overview |
|---|
February 24, 2015 Concurrency in D | ||||
|---|---|---|---|---|
| ||||
There is a int[] ,how to use the Fiber execute it ?
Such as :
import std.stdio;
import core.thread;
class DerivedFiber : Fiber
{
this()
{
super( &run );
}
private :
void run()
{
printf( "Derived fiber running.\n" );
faa();
}
}
int[] v;
void ftread()
{
DerivedFiber work = new DerivedFiber();
writeln( " will call " );
work.call();
writeln( " stop call " );
}
void faa()
{
writeln( " start " );
//Fiber.yield();
writeln( " start yield " );
foreach(c;v)
{
writeln( " current n is ",b(c) );
}
}
void b(int n)
{
...//do someting for n
}
void main()
{
int n=1;
while(n<=10_001)
{
v~=n;
n+=5000;
}
printf( "Execution returned to calling context.\n" );
ftread();
}
-------------end------------
I dont's think it's a good work.
How about you?
Thank you.
| ||||
February 25, 2015 Re: Concurrency in D | ||||
|---|---|---|---|---|
| ||||
Posted in reply to FrankLike | I have no idea what you mean but: 1/ You should probably be asking in learn. 2/ Most likely, you want std.parallelism | |||
February 25, 2015 Re: Concurrency in D | ||||
|---|---|---|---|---|
| ||||
Posted in reply to deadalnix | On Wednesday, 25 February 2015 at 02:04:37 UTC, deadalnix wrote:
> I have no idea what you mean but:
> 1/ You should probably be asking in learn.
> 2/ Most likely, you want std.parallelism
Thank you,I've send info in learn,but no person to help me.
"How to use Fiber" and "Need help on concurrency"
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply