Handling multiple fds with GHC
Gregory Collins
greg at gregorycollins.net
Wed Oct 7 18:32:22 UTC 2015
On Wed, Oct 7, 2015 at 10:16 AM, Markus Ongyerth <ongy44 at gmail.com> wrote:
> Mostly because i am used to the poll/select method I mentioned and that
> one works without any threading.
> I don't really mind using the threaded runtime though, it's more habit.
>
The stock stuff in the threaded runtime uses epoll() out of the box. When
you call hRead on a Handle, if the handle would block then you ultimately
get a call to threadWaitRead
<https://hackage.haskell.org/package/base-4.8.1.0/docs/GHC-Conc.html#v:threadWaitRead>
or
threadWaitWrite; these functions register interest in the given file
descriptor, and the IO manager / GHC runtime scheduler will wake up your
thread (GHC uses "green" threads) when the file descriptor becomes writable.
G
--
Gregory Collins <greg at gregorycollins.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/glasgow-haskell-users/attachments/20151007/d39a16f1/attachment.html>
More information about the Glasgow-haskell-users
mailing list