RE: Fail: thread killed

2001-03-08 Thread Simon Marlow

 Marcin 'Qrczak' Kowalczyk wrote:
 [snip]
  Since the very purpose of killThread is to kill the damn thread,
  I find it inconvenient to have to wrap any thread which is supposed
  to be killable with Exception.catch to avoid the message. Worse:
  it should use block and unblock, otherwise there is a small window
  where killing the thread will still display the message.
 [snip]
 I agree with this.  I also find it mildly irritating having to
 catch exceptions to stop GHC informing me that it's just garbage
 collected a thread which is permanently deadlocked.

Ok, so which exceptions should be displayed?

  - Marcin says all async exceptions should be suppressed in
child threads.

  - George says BlockedOnDeadMVar messages should also be
suppressed (presumably only on child threads).

any others?

I'm not sure I agree that StackOverflow/HeapOverflow messages should be
suppressed.  It might be really confusing if your program just deadlocks
instead of completing, when what actually happened was one of the child
threads got a stack overflow and died silently.

I can see the point about ThreadKilled though.  There's only one way to
kill a thread, and that's with killThread, so you don't want to see a
message saying the thread was killed (except that the presence of the
message indicates that the thread was alive before it was killed ;-).

Cheers,
Simon

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Fail: thread killed

2001-03-07 Thread George Russell

Marcin 'Qrczak' Kowalczyk wrote:
[snip]
 Since the very purpose of killThread is to kill the damn thread,
 I find it inconvenient to have to wrap any thread which is supposed
 to be killable with Exception.catch to avoid the message. Worse:
 it should use block and unblock, otherwise there is a small window
 where killing the thread will still display the message.
[snip]
I agree with this.  I also find it mildly irritating having to
catch exceptions to stop GHC informing me that it's just garbage
collected a thread which is permanently deadlocked.

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Fail: thread killed

2001-03-06 Thread Marcin 'Qrczak' Kowalczyk

I think I have raised the issue some time ago, but don't remember
why it hasn't been solved as I would like to.

Currently a thread which is killed displays Fail: thread killed,
e.g. in the following program:

import Concurrent
main:: IO ()
main = do
t - forkIO (threadDelay 100)
threadDelay 50
killThread t
threadDelay 50

Since the very purpose of killThread is to kill the damn thread,
I find it inconvenient to have to wrap any thread which is supposed
to be killable with Exception.catch to avoid the message. Worse:
it should use block and unblock, otherwise there is a small window
where killing the thread will still display the message.

I can probably agree that other kinds of exceptions are displayed;
maybe the programmer didn't know that exceptions are being thrown and
wants the diagnostic. It implies that any well-written code should
catch exceptions in all threads it creates (unless he is sure that the
code will not throw exceptions), since there shouldn't be compiler's
error output from a correct program. Not nice but I can live with that.

Should asynchronous exceptions be really displayed in threads other
than the main thread? IMHO not.

-- 
 __("  Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/
  ^^  SYGNATURA ZASTPCZA
QRCZAK


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users