Handling multiple fds with GHC
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
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.
Gregory Collins <greg at gregorycollins.net>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Glasgow-haskell-users