Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: tatsu_s@apollo.hp.com (Seiichi Tatsukawa)
Subject: Re: DCE Client/Server Exceptions
Date: Mon, 4 Apr 1994 18:29:51 GMT	[thread overview]
Message-ID: <CnqzDs.829@apollo.hp.com> (raw)
In-Reply-To: 2np4mf$7bh@paperboy.osf.org

In article <2np4mf$7bh@paperboy.osf.org> rsalz@osf.org (Rich Salz) writes:
>	#include <pthread.h>
>
>	int cancelmode;
>
>	cancelmode = pthread_setcancel(CANCEL_OFF);
>	/* ...critical section here... */
>	if (cancelmode == CANCEL_ON)
>	    (void)pthread_setcancel(CANCEL_ON);

And be careful about what you do in the critical section. If the
non-cancelable thread gets blocked forever, your server looses
one of the call executor threads...

Also restoring the general cancelability can be done by just
calling:
	(void)pthread_setcancel(cancelmode);

I think, in general, the server manager routine should handle the
forwarded cancel by using TRY/CATCH exception handling, e.g.:

TRY
{
    /* Do your critical work with the other process. */
}
/*
 * If you want to handle the cancel specifically. */
CATCH(pthread_cancel_e)
{
    ...
}
 */
CATCH_ALL
{
    /* Do the necessary cleanup for the connection with the other process. */
}
ENDTRY

---  Seiichi
-- 

     + Seiichi Tatsukawa (^[$BN)@n@:0l^[(B) tatsu_s@ch.hp.com +
     +    Hewlett-Packard/Open Systems Software Division      +


      reply	other threads:[~1994-04-04 18:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-04-03 14:43 DCE Client/Server Exceptions Paul Homchick
1994-04-04 12:31 ` Jon Mauney
1994-04-04 13:28 ` Rich Salz
1994-04-04 18:29   ` Seiichi Tatsukawa [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox