Coro::SemaphoreSet::try() doesn't work

Marc Lehmann schmorp at schmorp.de
Tue Feb 10 18:56:51 CET 2015


On Sun, Feb 08, 2015 at 05:37:36PM +0900, SATO Kentaro <kentaro at ranvis.com> wrote:
>     *Coro::SemaphoreSet::try = sub {
>         $_[0][0] && Coro::Semaphore::try ($_[0][1]{$_[1]} ||=
> Coro::Semaphore::_alloc $_[0][0]);

Actually, this should also be wrong - could you try if this version works for
your use cases?

   Coro::Semaphore::try ($_[0][1]{$_[1]} ||=
      $_[0][0] > 0 ? Coro::Semaphore::_alloc $_[0][0] : return 0)

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the perl mailing list