AST macros
Daniel Keep
daniel.keep.lists at gmail.com
Tue Mar 20 02:01:34 PDT 2007
David B. Held wrote:
> Daniel Keep wrote:
>>
>> [...]
>> Cooperative multithreading does not a coroutine make. Fibers, IIRC, are
>> just stack-based threads. Coroutines are *entirely different*, although
>> in this particular case they are implemented *using* stack threads.
>> [...]
>
> Wikipedia seems to think they are essentially the same thing:
>
> http://en.wikipedia.org/wiki/Fiber_%28computer_science%29
>
> Fibers are less than stack-based threads because they are cooperative.
> Whereas in a coroutine you write "return", in a fiber you write "yield".
> Otherwise, I believe they are closely isomorphic.
>
> Dave
Hmm... looks that way. I think mine are probably closer to generators
or channels than strictly coroutines, the difference being that Fibers
just do a transfer of control to the given fiber, whereas mine work more
like a function call.
Actually, thinking about it, I'm not entirely sure if mine classify as
coroutines or not... oh bother :P
-- Daniel
--
int getRandomNumber()
{
return 4; // chosen by fair dice roll.
// guaranteed to be random.
}
v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
More information about the Digitalmars-d
mailing list