[Haskell-cafe] Killing threads in foreign calls.

Gregory Collins greg at gregorycollins.net
Mon Apr 18 08:46:23 CEST 2011


On Mon, Apr 18, 2011 at 12:48 AM, Jason Dusek <jason.dusek at gmail.com> wrote:
>  I gather I need to write the busy loop for polling for data in
>  Haskell. Although libpq has a procedure -- PGgetResult -- that
>  polls for data, it would not respond to killThread.

Please don't use a busy loop! Instead use PQSocket() to get the
underlying socket file descriptor, and call
ThreadWaitRead/ThreadWaitWrite to use the system event dispatcher
(epoll() or select()) to efficiently multiplex.

G
-- 
Gregory Collins <greg at gregorycollins.net>



More information about the Haskell-Cafe mailing list