Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-12-16 Thread Simon Marlow
On 07/12/2010 21:30, Mitar wrote: Hi! On Wed, Dec 1, 2010 at 10:50 AM, Simon Marlowmarlo...@gmail.com wrote: Yes, but semantics are different. I want to tolerate some exception because they are saying I should do this and this (for example user interrupt, or timeout) but I do not want others,

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-12-16 Thread Mitar
Hi! On Thu, Dec 16, 2010 at 10:30 AM, Simon Marlow marlo...@gmail.com wrote: I've thought about whether we could support resumption in the past. It's extremely difficult to implement - imagine if the thread was in the middle of an I/O operation - should the entire I/O operation be restarted

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-12-16 Thread Richard O'Keefe
On 17/12/2010, at 12:03 PM, Mitar wrote: Yes, this is the same problem as when designing an operating system: what should happen to a system call if it is interrupted. And I agree with elegance of simply returning EINTR errno. This makes system calls much easier to implement and for user it

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-12-07 Thread Mitar
Hi! On Wed, Dec 1, 2010 at 10:50 AM, Simon Marlow marlo...@gmail.com wrote: Yes, but semantics are different. I want to tolerate some exception because they are saying I should do this and this (for example user interrupt, or timeout) but I do not want others, which somebody else maybe

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-12-02 Thread Simon Marlow
On 13/11/2010 19:08, Bit Connor wrote: On Wed, Nov 10, 2010 at 5:48 PM, Simon Marlowmarlo...@gmail.com wrote: [...] So we should say there are a few things that you can do that guarantee not to call any interruptible operations: - IORef operations - STM transactions that do not use retry

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-12-01 Thread Simon Marlow
On 01/12/2010 03:02, Mitar wrote: Hi! On Thu, Nov 18, 2010 at 2:19 PM, Simon Marlowmarlo...@gmail.com wrote: then it isn't uninterruptible, because the timeout can interrupt it. If you can tolerate a timeout exception, then you can tolerate other kinds of async exception too. Yes, but

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-30 Thread Mitar
Hi! On Thu, Nov 18, 2010 at 2:19 PM, Simon Marlow marlo...@gmail.com wrote: then it isn't uninterruptible, because the timeout can interrupt it.  If you can tolerate a timeout exception, then you can tolerate other kinds of async exception too. Yes, but semantics are different. I want to

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-18 Thread Mitar
Hi! On Wed, Nov 17, 2010 at 12:00 PM, Simon Marlow marlo...@gmail.com wrote: That's hard to do, because the runtime system has no knowledge of exception types, and I'm not sure I like the idea of baking that knowledge into the RTS. But currently it does have a knowledge of interruptible and

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-18 Thread Simon Marlow
On 18/11/2010 11:31, Mitar wrote: Hi! On Wed, Nov 17, 2010 at 12:00 PM, Simon Marlowmarlo...@gmail.com wrote: That's hard to do, because the runtime system has no knowledge of exception types, and I'm not sure I like the idea of baking that knowledge into the RTS. But currently it does have

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-17 Thread Simon Marlow
On 12/11/2010 07:49, Mitar wrote: On Wed, Nov 10, 2010 at 4:48 PM, Simon Marlowmarlo...@gmail.com wrote: You can use maskUninterruptible in GHC 7, but that is not generally recommended, Maybe there should be some function like maskUninterruptibleExceptUser which would mask everything except

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-15 Thread Bit Connor
On Wed, Nov 10, 2010 at 5:48 PM, Simon Marlow marlo...@gmail.com wrote: [...] So we should say there are a few things that you can do that guarantee not to call any interruptible operations:  - IORef operations  - STM transactions that do not use retry  - everything from the Foreign.*

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-11 Thread Simon Marlow
On 10/11/2010 17:52, Mitar wrote: Hi! On Wed, Nov 10, 2010 at 4:16 PM, Simon Marlowmarlo...@gmail.com wrote: The right way to fix it is like this: Optimist. ;-) let run = unblock doSomething `catches` [ Handler (\(_ :: MyTerminateException) - return ()),

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-11 Thread Mitar
Hi! On Wed, Nov 10, 2010 at 4:48 PM, Simon Marlow marlo...@gmail.com wrote: You can use maskUninterruptible in GHC 7, but that is not generally recommended, Maybe there should be some function like maskUninterruptibleExceptUser which would mask everything except UserInterrupt exception. Or

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-10 Thread Bas van Dijk
On Wed, Nov 10, 2010 at 10:50 AM, Mitar mmi...@gmail.com wrote: Hi! On Wed, Nov 10, 2010 at 8:54 AM, Bas van Dijk v.dijk@gmail.com wrote: A ThreadKilled exception is not printed to stderr because it's not really an error and should not be reported as such. So, how to make custom

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-10 Thread Mitar
Hi! On Wed, Nov 10, 2010 at 8:54 AM, Bas van Dijk v.dijk@gmail.com wrote: A ThreadKilled exception is not printed to stderr because it's not really an error and should not be reported as such. So, how to make custom exceptions which are not really an error? What do you mean by hanging

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-10 Thread Mitar
Hi! On Wed, Nov 10, 2010 at 1:39 PM, Bas van Dijk v.dijk@gmail.com wrote: First of all, are you sure you're using a unique MVar for each thread? If not, there could be the danger of deadlock. I am. Finally the 'putMVar terminated ()' computation is performed. Yes. But this should be

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-10 Thread Bas van Dijk
On Wed, Nov 10, 2010 at 2:39 PM, Mitar mmi...@gmail.com wrote: Strange. It would help if you could show more of of your code. I am attaching a sample program which shows this. I am using 6.12.3 on both Linux and Mac OS X. And I run this program with runhaskell Test.hs. Without throwIO

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-10 Thread Simon Marlow
On 10/11/2010 14:32, Bas van Dijk wrote: On Wed, Nov 10, 2010 at 2:39 PM, Mitarmmi...@gmail.com wrote: Strange. It would help if you could show more of of your code. I am attaching a sample program which shows this. I am using 6.12.3 on both Linux and Mac OS X. And I run this program with

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-10 Thread Simon Marlow
On 10/11/2010 13:39, Mitar wrote: I know that (I read one post from you some time ago). It is in TODO commend before this code. I am waiting for GHC 7.0 for this because I do not like current block/unblock approach. Because blocked parts can still be interrupted, good example of that is

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-10 Thread Mitar
Hi! On Wed, Nov 10, 2010 at 4:16 PM, Simon Marlow marlo...@gmail.com wrote: The right way to fix it is like this: Optimist. ;-)  let run = unblock doSomething `catches` [                Handler (\(_ :: MyTerminateException) - return ()),                Handler (\(e :: SomeException) -

[Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-09 Thread Mitar
Hi! I have been spend some time to debug this in my program. ;-) Why is ThreadKilled not displayed by RTS when send to thread (and unhandled), but any other exception is? For example, I am using custom exceptions to signal different kinds of thread killing. Based on those my threads cleanup in

Re: [Haskell-cafe] Printing of asynchronous exceptions to stderr

2010-11-09 Thread Bas van Dijk
On Tue, Nov 9, 2010 at 5:37 PM, Mitar mmi...@gmail.com wrote: Why is ThreadKilled not displayed by RTS when send to thread (and unhandled), but any other exception is? A ThreadKilled exception is not printed to stderr because it's not really an error and should not be reported as such. It is