Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] POSIX Threads: kill
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Carr <jfc@M...>
Subject: Re: [Caml-list] POSIX Threads: kill

> The problem is that C++ exception handling is based on unwinding stack
> frames one by one till a matching exception handler is found.  This
> requires stack frames to adhere strictly to a particular format, and
> be equipped with stack descriptors that the C++ stack unwind mechanism
> understands.  But of course the stack frames used ocamlopt-generated
> code do not adhere to this format, and do not come with C++ stack
> descriptors.  Hence, if the "systhreads" library was using
> pthread_exit and pthread_cancel, the C/C++ runtime system would try to
> unwind Caml stack frames, and just crash the whole program.


If I recall correctly, on some systems this is an easy problem to
solve because there is little or no runtime overhead in using the
standard stack layout and stack descriptor overhead.

On the other hand, ocaml does not use register windows on SPARC and
fixing that would be a big change.  Did somebody determine that the
"flat" model was faster, or was it just easier to implement?  SPARC
v9 may change the equation because it was designed to make save and
restore instructions fast, reducing window overflow traps to under
50 cycles.


(I remember trying to mix C++, exceptions, and threads back in 1995.
The combination was so unreliable that I gave up.  If a program used
exceptions the exception handlers interfered with thread stack
unwinding and caused core dumps inside the Solaris C++ support library.)

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners