regularfry
regularfry

Reputation: 3268

How to get the errno from an IOError in haskell?

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?

Upvotes: 4

Views: 262

Answers (1)

Don Stewart
Don Stewart

Reputation: 137957

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.

Upvotes: 5

Related Questions