[omniORB] omnithread and thread cancellation

ml ml@knorke.in-berlin.de
Wed, 8 May 2002 11:10:24 +0200


On Thu, May 02, 2002 at 01:15:07PM +0100, Duncan Grisby wrote:
> On Wednesday 1 May, ml wrote:
> 
> > has somebody ever introduced thread cancellation to
> > omnithreads?  I know, that omnithread lacks support for
> > thread cancellation for portability reasons, but we are in
> > need of thread cancellation and all our platform do have it
> > (Windows NT, Solaris, Linux).
> 
> Thread cancellation is almost always a bad idea, since you can never
> be certain what state things have been left in. It is far safer to
> implement it yourself with a flag that each thread checks
> occasionally. If the flag tells a thread to die, it can clean up
> safely.

Maybe it's just bad design, but in our case this would be
much more complicated than just "killing" the thread.  E.g.
the thread is in a select().  We know for sure, that the
thread does not have any resources allocated.  Anyway, most
thread libraries do support thread cancellation, so either
we have to switch to another library or we have to implement
it in omnithread.  Because omnithread is small, simple and
nice, we would prefer to stay with omnithread and add
cancellation.

Cheers!