Treating POSIX signals as exceptions?

Simon Marlow simonmar at
Mon Nov 17 10:53:46 EST 2003

> Well, bracket doesn't work with concurrent programs even in 
> the absense of
> signals (except in the main thread) so you don't lose 
> anything there.  If
> you write a concurrent program and want its threads to clean 
> up, you always
> have to code that yourself, for example using a bracket in 
> the main thread.

If you're referring to the fact that non-main concurrent threads aren't
required to terminate before the program terminates, then I think you're
placing the wrong emphasis by saying that "bracket doesn't work with
concurrent programs".  It works fine.

Are there any situations in which the cleanup action in a bracket might
not run?  Sure: 

  * the bracket is in a non-main thread and the program terminates
  * Out of memory (should be an exception, but isn't)
  * Power failure
  * etc. etc.

should we therefore say that bracket doesn't work?  I argue not.


More information about the Libraries mailing list