How to get the errno from an IOError in haskell?

僤鯓⒐⒋嵵緔 提交于 2019-12-10 16:55:36

问题


I'm on the haskell platform, GHC 6.12.1 as apt-get installed on Debian Squeeze. How can I get the underlying errno out of an IOError, given that I need it on a different thread to where it was originally raised?

The reason I need this is because I'm implementing a network protocol which exposes the actual errno value on the wire. Do I need to reconstruct it?


回答1:


errno is thread-local in GHC. You'll need to trap the errno in one thread; then send the value down a Chan or other communication abstraction to your listening thread.

The value itself is stored in thread TSO structure.



来源:https://stackoverflow.com/questions/10497765/how-to-get-the-errno-from-an-ioerror-in-haskell

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!