🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.programming.threads
Article #8

Re: Looking for best design for using pthreads in C++ objects

#8
From: David Brownell
Date: Wed, 06 Mar 1996 19:30
25 lines
1806 bytes
Webb Scales wrote:
> 
> Harald Fuchs wrote:
> > It's simply too easy to forget an appropriate catch clause.

... but if you have viable thread support from your C++ system,
that'll never be an issue.  That was a premise in my original
posting, as I recall:  the C++ exception runtime interacts in
the natural way with the POSIX cancellation interface (i.e. the
destructors are the C++ version of the C "cleanup handlers").

Admittedly POSIX.1c doesn't have a C++ binding yet.  But the
rationale makes clear what's intended:  use the language's
native exception handling facilities to handle cancellation.

> But, that's my point exactly!  If it's easy to forget the catch clause,
> then it is even easier to forget to rectify the state of the shared
> data.

These go together in all good MT-aware programming styles, just like
policies like "mutex state isn't changed by function calls".  As with
all style guidelines, they can be broken if you know what you're doing;
I tend to call that "rocket science mode".

- Dave
Technical Details
Message-ID: <313DE7CF.7AF1@ix.netcom.com>
Path: arc1-ca.pugleaf.net!ix.netcom.com!netnews
References: <3128ff8b.666031216@news.clark.net> <312A0E5F.7B2C@ix.netcom.com> <31320705.41C6@zko.dec.com> <puag248wxl.fsf@themroc.colibri.de> <3134F4F5.167E@zko.dec.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!ix.netcom.com!netnews
From: David Brownell <brownell@ix.netcom.com>
Newsgroups: comp.programming.threads,comp.lang.c++,comp.unix.osf.osf1,comp.unix.programmer,comp.object
Subject: Re: Looking for best design for using pthreads in C++ objects
Date: Wed, 06 Mar 1996 09:30:23 -1000
Organization: Dave's VAX
Message-ID: <313DE7CF.7AF1@ix.netcom.com>
References: <3128ff8b.666031216@news.clark.net> <312A0E5F.7B2C@ix.netcom.com>
   <31320705.41C6@zko.dec.com> <puag248wxl.fsf@themroc.colibri.de> <3134F4F5.167E@zko.dec.com>
NNTP-Posting-Host: haw-ak1-06.ix.netcom.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-NETCOM-Date: Wed Mar 06 11:34:11 AM PST 1996
X-Mailer: Mozilla 2.0 (Win95; I)