Browse thread
[Caml-list] Native Threads
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Sven LUTHER <luther@d...> |
| Subject: | Re: [Caml-list] Native Threads |
On Sun, Oct 13, 2002 at 10:43:53AM +0200, Xavier Leroy wrote: > > I've just been playing with threads and I noticed at execution > > time that Thread.kill is not implemented by the posix-compiled > > version of the library. I used this flag because I thought that > > it would be faster (please correct me if I'm wrong), and there > > was no mention that Thread.kill would not be implemented. > > By looking at the sources, I learned that the reason is > > "problems with cleanup handlers on several platforms". > > That's fine with me, but I would like to compile my > > program :) > > The documentation should definitely be updated to mention that > Thread.kill is not only unavailable with system threads, but also > deprecated and definitely not advised. Why not remove it entirelly ? It is only confusing to have kill, but advice not to use it, and have it only working in some conditions (caml threads) ? > Being able to terminate any thread at any time, without cooperation > from the thread, is extremely dangerous: what if the killed thread was > holding mutexes? (I think this has been discussed recently on this > list.) For this reason, thread APIs either provide a low-level "kill" > operation and strongly adivse not to use it (Win32, Java), or they > provide a more controlled "cancellation" mechanism (POSIX) that is > slightly less risky, but doesn't (currently) map well to Caml threads. > > So: don't kill threads. Let them live a long and happy life :-) Well, the idea is to interactively kill threads that loop forever or something else such. I know you adviced me to have a the thread check each time if it can continue living, and stop if it is told not so, and this is what i will be doind, but what about having a thread function available in the thread library that does this in a somewhat standardized way ? Friendly, Sven Luther ------------------- 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