Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Has the thread cancellation problem evolved ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-08-28 (15:12)
From: Brian Hurt <bhurt@j...>
Subject: Re: [Caml-list] Has the thread cancellation problem evolved ?
Robert Fischer wrote:

> Brian Hurt wrote:
>> So what happens if I throw an infinite loop into an exception handler?
> Now, my experience with .Net is somewhat dated, but I'm pretty sure it 
> re-hangs on your loop, and signaling another abort will break out of 
> your loop and continue up the chain of exception handlers.  At least 
> once upon a time, there was a very large business which I worked for 
> that did a lot of concurrent .Net work, and the standard solution was 
> to keep signaling the abort until the thing finally died.
> ~~ Robert.
Until you get someone "clever", who does something like (in Ocaml):

let rec do_my_work () =
       do_a_bunch_of_work ()
    | Thread_abort_exception ->
       (* Ack!  Someone tried to kill me!  I refuse to die! *)
       do_my_work ()

I suppose eventually you'd blow stack.

Then, there's the what-if:

let rec example () =
       do_a_bunch_of_work ()
    | Thread_abort_exception ->
       raise (Invalid_arg "Ack!  They got me!")

i.e. what happens if my catch expression raises another (different) 

Not to mention the fact that this solution requires a rather intrusive 
change to the run time, and a special exception which behaves 
differently from every other exception.