Liste des Groupes | Revenir à cl c |
Lawrence D'Oliveiro pisze:i once said probably call queues should be a god way to do multithreading becouse say you got a routine that calculates and draw a vertical line of mandelbrotOn Wed, 20 Nov 2024 17:34:34 +0100, Janis Papanagnou wrote:i dont know to much on coroutines (what i knew i forgot as even my memory this year is terribly bad) or simule bot from some other
>[*] A friend of mine just recently implemented the code frame for a>
roguelike and followed the suggestion of an event based object-oriented
implementation; it worked well, he told me.
The next step would be to use coroutines so the logic of a longer-running
task, which has to wait for other events at multiple points, can be
written in a single linear stream without having to be fragmented into
multiple callbacks.
>
reasoning i know thet "call queue" is veru good thing
possibly it may be better or at least equal in thiat coroutines or
what was in simula
in basic call queue it gioes klike this afai
for(int i=0; i<all; i++)
add_queue foo(i);
foo() are storred in queue so then can be run i pseudo parralel
mode at some point
add_queue stores function adress and argument on stack like queue
here in rogualike it would use this time variable also
DoAction(int i)
{
if(character[i].action_end > current_time) return;
// do nothing until time comes
// time has come do something
character[i],action_end += 300;
add_queue DoAction(i); //put yourself on queue
}
StartUp()
{
for(int i=0; i<all; i++) add_queue DoAction(i);
}
// in some code
run_queue // queue may add soem alelemnts but also executed things are taken out of queue
i guess it should be something like that
Les messages affichés proviennent d'usenet.