问题描述
网络上有许多关于启用了epoll / kqueue的GHC的旧信息。例如,上的代码不再编译。有人可以提供一个基本的例子,说明如何使用这个特性和现代GHC版本来构建,例如一个TCP服务器,只是在连接上响应Hello?
GHC的IO管理器使用epoll / kqueue特别程序员的努力。只需编写简单的线程程序 - 将每个并发的阻塞IO调用放入一个单独的线程 - GHC将确保它按照您希望的方式工作。
There is a lot of old information on the net regarding an epoll/kqueue enabled GHC. For example, the code on the Simple Servers wiki page doesn't compile anymore.
Could someone provide a basic example of how to use this feature with a modern GHC version to build, e.g. a TCP server that just responds with "Hello" on connect?
GHC's IO manager uses epoll/kqueue under the hood without any special programmer effort. Just write the naive threaded program -- that puts each concurrent blocking IO call in a separate thread -- and GHC will make sure it works out the way you want it to.
这篇关于如何使用GHC / Haskell的启用epoll / kqueue的版本进行网络连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!