http://d.hatena.ne.jp/tokuhirom/20090710/1247196134 ãã® Coro ã®ä¾ã Go ã§ãã£ã¦ã¿ã¾ãã ã¾ãç¹å®æ° (ããã§ã¯ 3) ã® worker thread ãç«ã¡ä¸ãã¦ããã¦ãããã«ã¡ãã»ã¼ã¸ãéã£ã¦ä»äºãããã¢ãã«ãã¡ãã»ã¼ã¸ã®ããã¨ãã« Coro::Channel ã使ãã¾ãã use Coro; use Coro::Channel; use Coro::Timer; my $ch = Coro::Channel->new; sub worker { while (1) { my $url = $ch->get; printf("worker(%d): %s\n", $_[0], $url); Coro::Timer::sleep(1); } } my @coros = ( async { worker(1) }, async
{{#tags}}- {{label}}
{{/tags}}