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-27 (07:43)
From: Markus E L <ls-ocaml-2006@m...>
Subject: Re: [Caml-list] Has the thread cancellation problem evolved ?

Daniel Bünzli wrote:

> Le 25 août 07 à 17:29, skaller a écrit :
>> There is something I don't understand here.
> What you don't understand is that ocaml has a runtime system which
> leaves some room for designing around what exists at the os level.
>> If the source of the problem is a blocking operation, the solution
>> is simple: don't use blocking operations!
> This is not the source of the problem. What I want is to allow users
> to initiate and cancel computations whenever they want. Computations
> can be lengthy even tough they do not invoke a blocking operation.

I'm sure the approach I'm suggesting might be too simple, perhaps you
even have thought about it and it doesn't meet your demands: But have
you thought about doing the users computation in a fork()ed child
process and communicate the result(s) back by marshalling over a pipe?
The communication band width after forking is limited (but the child
process has all the data of the parent process at the time of the
fork()). On the other side it would solve the (a) code unloading
problem and (b) the cancellation every time problem (you can always
cancel by sending as SIGKILL :-).

Regards -- Markus