Perl 的 Threading 實做:Coro

去年「Perl - PSGI」這篇文章裡面提到 Perl 的 threading 一直是頭痛的問題之一,唐鳳在留言上推薦用 Coro 而非原來的 thread。

實際測試後發現並非 OS level 的 threading,而是利用抽換的方式將系統內許多 blocking function 換掉,並且支援常用到的 module (像是 libwww-perl 系列),使得現有的程式要 porting 到 Coro 上會簡單很多,寫起來也的確比較像 threading 程式。(雖然實做比較接近 event-based)

附上之前寫來測試的程式,用的是 PIXNETAPI

One thought on “Perl 的 Threading 實做:Coro”

Leave a Reply

Your email address will not be published. Required fields are marked *