On Tue Jul 07 13:44:33 2015, voegelas wrote: > On Mon Dec 29 10:32:42 2014, r...@hoelz.ro wrote: > > See also https://rt.perl.org/Ticket/Display.html?id=123515 > > The attached script demonstrates the busy waiting. The script also > leaks memory. In the output of top(1) the CPU is always at 100% and > DATA grows: > > PID USER VIRT RES SHR %CPU %MEM TIME+ DATA COMMAND > 46088 andreas 256m 98m 19m 100 1.3 0:03.27 220m moar > > PID USER VIRT RES SHR %CPU %MEM TIME+ DATA COMMAND > 46088 andreas 426m 269m 19m 100 3.5 3:57.15 389m moar > > Tested with Rakudo Star Release 2015.06 on Slackware64-current.
earliest is gone, in favor of react/whenever, which also works on supplies. I just replaced the earliest loop: loop { earliest * { more $time_channel { say "Time: $_" } more $mpd_channel { say "Song: $_" } } } With: react { whenever $time_channel { say "Time: $_" } whenever $mpd_channel { say "Song: $_" } } And can confirm it works and that the CPU stays at zero while waiting. Can't really test the CPU usage easily, but that whenever can be used with multiple channels is tested in S17-supply/syntax.t.