Re: [GHC] #3997: Lazy I/O and asynchronous exceptions don't mix well

2012-02-27 Thread GHC
#3997: Lazy I/O and asynchronous exceptions don't mix well --+- Reporter: simonmar | Owner: Type: bug | Status: closed

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

2010-12-16 Thread Simon Marlow
the exception in a different thread instead. You have complete control over which asynchronous exceptions are thrown to a thread. You might argue that StackOverflow/HeapOverflow aren't under your control - but in fact StackOverflow will never be raised inside mask. If/when we ever implement HeapOverflow

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 Simon Marlow
the exception in a different thread instead. You have complete control over which asynchronous exceptions are thrown to a thread. You might argue that StackOverflow/HeapOverflow aren't under your control - but in fact StackOverflow will never be raised inside mask. If/when we ever implement HeapOverflow

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-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
to the Control.Exception documentation, in the section on Interruptible operations. Suggestions for improvements are welcome: It is useful to think of 'mask' not as a way to completely prevent asynchronous exceptions, but as a filter that allows them to be raised only at certain places

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-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-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-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: [GHC] #4400: Asynchronous exceptions in runInUnboundThread

2010-11-17 Thread GHC
#4400: Asynchronous exceptions in runInUnboundThread -+-- Reporter: basvandijk | Owner: simonmar Type: proposal| Status: closed Priority: high

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-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-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-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: [GHC] #1036: Asynchronous exceptions improvements

2010-11-10 Thread GHC
#1036: Asynchronous exceptions improvements -+-- Reporter: simonmar| Owner: simonmar Type: task| Status: closed Priority: normal

Re: [GHC] #1036: Asynchronous exceptions improvements

2010-11-10 Thread GHC
#1036: Asynchronous exceptions improvements -+-- Reporter: simonmar| Owner: simonmar Type: task| Status: closed Priority: normal

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

2010-11-10 Thread Bas van Dijk
to catch it so it will be reported. Finally, your code has dangerous deadlock potential: Because you don't mask asynchronous exceptions before you fork it could be the case that an asynchronous exception is thrown to the thread before your exception handler is registered. This will cause the thread

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
asynchronous exceptions before you fork it could be the case that an asynchronous exception is thrown to the thread before your exception handler is registered. This will cause the thread to abort without running your finalizer: 'putMVar terminated ()'.  Your 'takeMVar terminated' will then deadlock

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
), the following things can raise asynchronous exceptions: - interruptible operations (MVar operations, throwTo, atomically) Since we can't be certain that an IO operation from a library does not invoke any interruptible operations, we have to assume that all IO functions from libraries can raise

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) -

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

2010-11-10 Thread Bas van Dijk
to catch it so it will be reported. Finally, your code has dangerous deadlock potential: Because you don't mask asynchronous exceptions before you fork it could be the case that an asynchronous exception is thrown to the thread before your exception handler is registered. This will cause the thread

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
asynchronous exceptions before you fork it could be the case that an asynchronous exception is thrown to the thread before your exception handler is registered. This will cause the thread to abort without running your finalizer: 'putMVar terminated ()'.  Your 'takeMVar terminated' will then deadlock

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
), the following things can raise asynchronous exceptions: - interruptible operations (MVar operations, throwTo, atomically) Since we can't be certain that an IO operation from a library does not invoke any interruptible operations, we have to assume that all IO functions from libraries can raise

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) -

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

[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

Re: [GHC] #1036: Asynchronous exceptions improvements

2010-11-08 Thread GHC
#1036: Asynchronous exceptions improvements -+-- Reporter: simonmar| Owner: simonmar Type: task| Status: closed Priority: normal

Re: [GHC] #4400: Asynchronous exceptions in runInUnboundThread

2010-11-08 Thread GHC
#4400: Asynchronous exceptions in runInUnboundThread -+-- Reporter: basvandijk|Owner: simonmar Type: proposal | Status: patch Priority: high

Re: [GHC] #1036: Asynchronous exceptions improvements

2010-11-08 Thread GHC
#1036: Asynchronous exceptions improvements -+-- Reporter: simonmar| Owner: simonmar Type: task| Status: closed Priority: normal

Re: [GHC] #1036: Asynchronous exceptions improvements

2010-11-07 Thread GHC
#1036: Asynchronous exceptions improvements -+-- Reporter: simonmar| Owner: simonmar Type: task| Status: closed Priority: normal

Re: [GHC] #4400: Asynchronous exceptions in runInUnboundThread

2010-10-30 Thread GHC
#4400: Asynchronous exceptions in runInUnboundThread -+-- Reporter: basvandijk| Owner: Type: proposal | Status: patch Priority: normal

Re: [GHC] #4400: Asynchronous exceptions in runInUnboundThread

2010-10-16 Thread GHC
#4400: Asynchronous exceptions in runInUnboundThread -+-- Reporter: basvandijk| Owner: Type: proposal | Status: new Priority: normal

[GHC] #4400: Asynchronous exceptions in runInUnboundThread

2010-10-14 Thread GHC
#4400: Asynchronous exceptions in runInUnboundThread -+-- Reporter: basvandijk| Owner: Type: proposal | Status: new Priority: normal

Re: [GHC] #3944: Asynchronous exceptions and laziness bugs (with fixes) in Control.Concurrent.QSem/QSemN

2010-07-09 Thread GHC
#3944: Asynchronous exceptions and laziness bugs (with fixes) in Control.Concurrent.QSem/QSemN -+-- Reporter: basvandijk | Owner: simonmar Type: bug | Status: closed

Re: [GHC] #1036: Asynchronous exceptions improvements

2010-07-09 Thread GHC
#1036: Asynchronous exceptions improvements -+-- Reporter: simonmar| Owner: simonmar Type: task| Status: closed Priority: normal

Re: [GHC] #3944: Asynchronous exceptions and laziness bugs (with fixes) in Control.Concurrent.QSem/QSemN

2010-05-05 Thread GHC
#3944: Asynchronous exceptions and laziness bugs (with fixes) in Control.Concurrent.QSem/QSemN -+-- Reporter: basvandijk|Owner: simonmar Type: bug | Status: patch

Re: [GHC] #3944: Asynchronous exceptions and laziness bugs (with fixes) in Control.Concurrent.QSem/QSemN

2010-04-29 Thread GHC
#3944: Asynchronous exceptions and laziness bugs (with fixes) in Control.Concurrent.QSem/QSemN -+-- Reporter: basvandijk|Owner: Type: bug | Status: patch

Re: [GHC] #3997: Lazy I/O and asynchronous exceptions don't mix well

2010-04-21 Thread GHC
#3997: Lazy I/O and asynchronous exceptions don't mix well --+- Reporter: simonmar | Owner: Type: bug | Status: closed

[GHC] #3997: Lazy I/O and asynchronous exceptions don't mix well

2010-04-20 Thread GHC
#3997: Lazy I/O and asynchronous exceptions don't mix well -+-- Reporter: simonmar |Owner: Type: bug | Status: new

[Haskell-cafe] catchSTM and asynchronous exceptions

2009-07-18 Thread Peter Robinson
I couldn't find any information on whether catchSTM catches asynchronous exceptions so I tried to run the following: import Control.Concurrent.STM import Control.Concurrent import Control.Exception import Prelude hiding (catch) test = do tid - myThreadId forkIO (threadDelay 500

[Haskell-cafe] Brackets and Asynchronous Exceptions

2009-04-15 Thread Andrew Gallagher
that an asynchronous exception could be raised in this thread after openFile executes but *before* the appropriate handlers are installed and the operation is run, preventing hClose from executing? If 'bracket' does not handle this case, should I be using the block/unblock functions to disable asynchronous

Re: [Haskell-cafe] Brackets and Asynchronous Exceptions

2009-04-15 Thread Jason Dagit
this case, should I be using the block/unblock functions to disable asynchronous exceptions: block   (bracket      (openFile filename ReadMode)      (hClose)      (\fileHandle - do         unblock         ({ ... }))) Does this answer your question? http://haskell.org/ghc/docs/latest/html

Re: [Haskell-cafe] Brackets and Asynchronous Exceptions

2009-04-15 Thread Andrew Gallagher
be raised in this thread after openFile executes but *before* the appropriate handlers are installed and the operation is run, preventing hClose from executing? If 'bracket' does not handle this case, should I be using the block/unblock functions to disable asynchronous exceptions: block   (bracket

[Haskell-cafe] Re: Guidance on using asynchronous exceptions

2007-11-16 Thread Simon Marlow
Yang wrote: To follow up on my previous post (Asynchronous Exceptions and the RealWorld), I've decided to put together something more concrete in the hopes of eliciting response. I'm trying to write a library of higher-level concurrency abstractions, in particular for asynchronous systems

[Haskell-cafe] Re: Guidance on using asynchronous exceptions

2007-11-16 Thread Yang
oleg-at-pobox.com |haskell-cafe| wrote: Yang wrote: (Something like this is straightforward to build if I abandon Concurrent Haskell and use cooperative threading, and if the operations I wanted to perform could be done asynchronously.) All operations could be done asynchronously, at least on

[Haskell-cafe] Re: Guidance on using asynchronous exceptions

2007-11-16 Thread oleg
Yang wrote: Furthermore, is there any way to embed this information [about async execptions] in the type system, so that Haskellers don't produce async-exception-unaware code? (Effectively, introducing checked interrupts?) Yes, it is possible to make the information about exceptions and

[Haskell-cafe] Re: Guidance on using asynchronous exceptions

2007-11-16 Thread Aaron Denney
On 2007-11-16, Yang [EMAIL PROTECTED] wrote (quoting a paper): This style of concurrency is, of course, not new. Component architectures where data flows through components (rather than control) have been called 'actor-oriented' [35]. These can take many forms. Unix pipes resemble PN, although

[Haskell-cafe] Asynchronous exceptions and the RealWorld

2007-11-15 Thread Yang
- I want to set timeouts on various IO operations in an existing library, ftphs. However, even if I wrap every call in `block`, it's unclear whether ftphs has been coded to deal with asynchronous exceptions, or whether state could be rendered inconsistent. Is there any solution for this aside

[Haskell-cafe] Guidance on using asynchronous exceptions

2007-11-15 Thread Yang
To follow up on my previous post (Asynchronous Exceptions and the RealWorld), I've decided to put together something more concrete in the hopes of eliciting response. I'm trying to write a library of higher-level concurrency abstractions, in particular for asynchronous systems programming

[Haskell] What guarantees (if any) do interruptible operations have in presence of asynchronous exceptions?

2006-12-05 Thread Cat Dancer
From the discussion of Help needed interrupting accepting a network connection, what we have so far is: * To break out of an accept call, an asynchronous exception is needed. * The presence of asynchronous exceptions complicates the other code used to report if accept completed

Re: [Haskell] What guarantees (if any) do interruptible operations have in presence of asynchronous exceptions?

2006-12-05 Thread Chris Kuklewicz
is: * To break out of an accept call, an asynchronous exception is needed. * The presence of asynchronous exceptions complicates the other code used to report if accept completed or was interrupted, whether that code is written using MVar's or STM. Thus the next question

Re: [Haskell] What guarantees (if any) do interruptible operations have in presence of asynchronous exceptions?

2006-12-05 Thread Cat Dancer
-- for sure? Then it would be easy to program with MVar's in the presence of asynchronous exceptions. When you caught an asynchronous exception, you could set a flag, and then redo the putMVar. If you call that easy then sure. For STM, is atomically an interruptible operation? If it is, what

Re: [Haskell] What guarantees (if any) do interruptible operations have in presence of asynchronous exceptions?

2006-12-05 Thread Chris Kuklewicz
Cat Dancer wrote: On 12/5/06, Chris Kuklewicz [EMAIL PROTECTED] wrote: Making small programs to test these properties is a good sanity check. For instance I just leaned that safePoint = unblock ( return () ) does not work. Maybe if you do something to allocate some memory inside of the

RE: Signals + minimal proposal (was Re: asynchronous exceptions)

2006-04-11 Thread Simon Marlow
On 10 April 2006 22:19, John Meacham wrote: On Fri, Apr 07, 2006 at 02:58:01PM +0100, Simon Marlow wrote: According to your definition of exitWith above, I can't both raise an exception *and* exit in the same thread. If I register an onExit handler that throws an exception to the current

Re: Signals + minimal proposal (was Re: asynchronous exceptions)

2006-04-11 Thread John Meacham
On Tue, Apr 11, 2006 at 08:54:32AM +0100, Simon Marlow wrote: now If I have a handler registered that throws an exception to the current thread, what happens? handleLoop is aborted, the exception is propagated to the top level of the thread, where the top-level exception handler calls

Re: Signals + minimal proposal (was Re: asynchronous exceptions)

2006-04-11 Thread David Roundy
On Mon, Apr 10, 2006 at 02:19:23PM -0700, John Meacham wrote: On Mon, Apr 10, 2006 at 02:58:20PM +0100, Simon Marlow wrote: Suppose I want to do some action with a temporary file: bracket newTempFile (\f - removeTempFile f) (\f - doSomethingWith f) Under

Re: Signals + minimal proposal (was Re: asynchronous exceptions)

2006-04-10 Thread John Meacham
On Mon, Apr 10, 2006 at 02:58:20PM +0100, Simon Marlow wrote: Suppose I want to do some action with a temporary file: bracket newTempFile (\f - removeTempFile f) (\f - doSomethingWith f) Under your scheme, this code doesn't get to remove its temporary file on

RE: asynchronous exceptions

2006-04-07 Thread Simon Marlow
arbitrary exceptions thrown by calls to library functions. Asynchronous exceptions thrown by interruptible operations just fall into this category. BTW, I just realised a better way to express block. If block is supposed to count nesting, then we have a problem that you can still unblock exceptions even

RE: Signals + minimal proposal (was Re: asynchronous exceptions)

2006-04-07 Thread Simon Marlow
On 06 April 2006 23:20, John Meacham wrote: I'm not proposing that we ignore signals, just that we should clearly delimit the platform-specific bits, perhaps by putting signal support into an addendum. yeah, I was thinking a separate environment addendum should be in the report, which

RE: Signals + minimal proposal (was Re: asynchronous exceptions)

2006-04-07 Thread Simon Marlow
On 07 April 2006 13:24, David Roundy wrote: The catch to this [no pun intended] is that when the main thread exits all other threads are silently terminated, without the chance to clean up... This is a mistake in GHC, I think. When someone calls exit, or when the main thread exits, all the

RE: Signals + minimal proposal (was Re: asynchronous exceptions)

2006-04-07 Thread Simon Marlow
is in progress, but that implies explicit checking of the flag all over the place, which is what asynchronous exceptions are designed to avoid. When *do* we exit, in fact? When all the exit handlers have finished? Exceptions are the right way to handle releasing resources, and they are the right way

Re: asynchronous exceptions

2006-04-07 Thread Marcin 'Qrczak' Kowalczyk
Simon Marlow [EMAIL PROTECTED] writes: BTW, I just realised a better way to express block. If block is supposed to count nesting, then we have a problem that you can still unblock exceptions even within a block by using sufficient number of unblocks, so the right way is to give block this

Re: Signals + minimal proposal (was Re: asynchronous exceptions)

2006-04-07 Thread John Meacham
On Fri, Apr 07, 2006 at 02:58:01PM +0100, Simon Marlow wrote: Of course you could implement some global flag to say that an exit is in progress, but that implies explicit checking of the flag all over the place, which is what asynchronous exceptions are designed to avoid. When *do* we exit

Signals + minimal proposal (was Re: asynchronous exceptions)

2006-04-06 Thread John Meacham
On Wed, Apr 05, 2006 at 03:41:55PM +0100, Simon Marlow wrote: I have been giving signals some thought, and resarching what other languages do, and have a semi-proposal-maybe. We should be careful here: the Haskell standard has so far remained platform-independent, and I think it would be

Re: asynchronous exceptions

2006-04-06 Thread Marcin 'Qrczak' Kowalczyk
Simon Marlow [EMAIL PROTECTED] writes: I think it's unnecessary to treat signals in the way you do - you're assuming that a signal interrupts the current thread and runs a new computation (the signal handler) on the same stack, completely blocking the interrupted thread until the signal

Re: asynchronous exceptions (was: RE: Concurrency)

2006-04-05 Thread David Roundy
On Tue, Apr 04, 2006 at 01:33:39PM +0100, Simon Marlow wrote: I'm not sure whether asynchronous exceptions should be in Haskell'. I don't feel entirely comfortable about the interruptible operations facet of the design, and I'm hoping that STM can clean things up: after all, STM already gives

RE: asynchronous exceptions (was: RE: Concurrency)

2006-04-05 Thread Simon Marlow
delayed indefinitely, unless the target thread remains inside a block. Just like the fairness property for MVars. I think this is fine. There's no need for strong guarantees that asynchronous exceptions are delivered soon or interrrupt any particular external function calls, or even interrupt

RE: asynchronous exceptions (was: RE: Concurrency)

2006-04-05 Thread Simon Marlow
On 05 April 2006 13:38, John Meacham wrote: On Wed, Apr 05, 2006 at 07:47:08AM -0400, David Roundy wrote: For me, asynchronous exceptions are the primary reason to use concurrent Haskell. They're the only way I'm aware of to write a program that handles signals in Haskell, and it's be a real

Re: asynchronous exceptions

2006-04-05 Thread Marcin 'Qrczak' Kowalczyk
Simon Marlow [EMAIL PROTECTED] writes: I'm not sure whether asynchronous exceptions should be in Haskell'. I don't feel entirely comfortable about the interruptible operations facet of the design, I designed that differently for my language. There is a distinct synchronous mode where

asynchronous exceptions (was: RE: Concurrency)

2006-04-04 Thread Simon Marlow
I'm not sure whether asynchronous exceptions should be in Haskell'. I don't feel entirely comfortable about the interruptible operations facet of the design, and I'm hoping that STM can clean things up: after all, STM already gives you a much nicer way to program in an exception-safe way, as long

Asynchronous exceptions and resume

2003-03-26 Thread Nick Name
Hi all, is there a way, or is it planned to, or has anyone published articles on... resuming from asynchronous exceptions? I mean: it would be useful there was a suspend :: ThreadID - IO () where the result is the remaining computation of the other thread, wich one could forkIO again

RE: Concurrent Haskell, asynchronous exceptions and interruptibility (again)

2002-10-30 Thread Simon Marlow
For Concurrent Haskell, with respect to asynchronous exceptions, can a thread receive an asynchronous exception if it's evaluating an expression that could potentially block on IO when evaluated within the block function? Specifically, is interruptibility determined statically

Re: Asynchronous Exceptions

2001-11-27 Thread Steinitz, Dominic J
-- Forwarded by Dominic Steinitz/HEATHROW/BRITISH AIRWAYS/GB on 27/11/2001 09:59 --- From: Dominic Steinitz on 27/11/2001 08:16 To: uk1o cc: haskell bcc: Subject:Re: Asynchronous Exceptions Hannah, I was thinking

RE: Asynchronous Exceptions

2001-11-27 Thread Simon Marlow
On Fri, Nov 23, 2001 at 09:38:35AM -, Simon Marlow wrote: [...] However, I agree that sometimes you really want to be able to do this, so perhaps we need another form of 'block' which doesn't allow *any* exceptions to be delivered, for those times when you know that the time

Re: Asynchronous Exceptions

2001-11-26 Thread Hannah Schroeter
Hello! On Fri, Nov 23, 2001 at 09:38:35AM -, Simon Marlow wrote: [...] However, I agree that sometimes you really want to be able to do this, so perhaps we need another form of 'block' which doesn't allow *any* exceptions to be delivered, for those times when you know that the time

Asynchronous Exceptions

2001-11-23 Thread Steinitz, Dominic J
Can someone help me understand how this works? I've been reading the paper Asynchronous Exceptions in Haskell. This gives a combinator finally :: IO a - IO b - IO s finally a b = block (do { r - catch (unblock a) (\e - do { b; throw e }); b; return r; }) Now suppose we

RE: Asynchronous Exceptions

2001-11-23 Thread Simon Marlow
Can someone help me understand how this works? I've been reading the paper Asynchronous Exceptions in Haskell. This gives a combinator finally :: IO a - IO b - IO s finally a b = block (do { r - catch (unblock a) (\e - do { b; throw e }); b; return r