[Rio-pm] Coro

Stanislaw Pusep creaktive em gmail.com
Quarta Agosto 15 11:18:41 PDT 2012


Acho que não...
Tinha o teor desse artigo:
http://blog.64p.org/entry/20090630/1246324092 (repare
na frase "Coro is black magic.") :/
Mas creio que achei outro tipo de resposta para o que estava procurando,
"time-sliced multitasking using interval timers":

# "timeslice" the given block
sub timeslice(&) {
   use Time::HiRes ();

   Coro::on_enter {
      # on entering the thread, we set an VTALRM handler to cede
      $SIG{VTALRM} = sub { cede };
      # and then start the interval timer
      Time::HiRes::setitimer &Time::HiRes::ITIMER_VIRTUAL, 0.01, 0.01;
   };
   Coro::on_leave {
      # on leaving the thread, we stop the interval timer again
      Time::HiRes::setitimer &Time::HiRes::ITIMER_VIRTUAL, 0, 0;
   };

   &{+shift};
}

# use like this:
timeslice {
   # The following is an endless loop that would normally
   # monopolise the process. Since it runs in a timesliced
   # environment, it will regularly cede to other threads.
   while () { }
};

ABS()



2012/8/15 breno <breno em rio.pm.org>

> Vc se refere a isso?
>
> https://metacpan.org/module/Coro::State#MODEL
>
> []s
>
> -b
>
> 2012/8/14 Stanislaw Pusep <creaktive em gmail.com>:
> > Pessoas, eu lembro como se fosse ontem que em algum lugar da documentação
> > (https://metacpan.org/module/Coro) havia uma referência descrevendo
> como o
> > Coro foi implementado... Não estou conseguindo mais achar :(
> > Alguém lembra/sabe?
> >
> > ABS()
> >
> >
> > _______________________________________________
> > Rio-pm mailing list
> > Rio-pm em pm.org
> > http://mail.pm.org/mailman/listinfo/rio-pm
> _______________________________________________
> Rio-pm mailing list
> Rio-pm em pm.org
> http://mail.pm.org/mailman/listinfo/rio-pm
>
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://mail.pm.org/pipermail/rio-pm/attachments/20120815/5f58764c/attachment.html>


Mais detalhes sobre a lista de discussão Rio-pm