This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Interleaving pthread_cleanups in C and C++


On Mon, May 05, 2003 at 08:10:56PM -0300, Alexandre Oliva wrote:
> On May  5, 2003, Mark Mitchell <mark@codesourcery.com> wrote:
> 
> >> Perhaps even
> >> 
> >> #define pthread_cleanup_push(H, A) \
> >> { struct __pthread_cleanup __pc = { (H), (A), true } \
> >> __attribute__((cleanup (__pthread_cleanup_routine)));
> 
> > This is a good idea.
> 
> The only thing I find sad about this is that it doesn't seem to enable
> one to define __try and __finally as macros with the expected
> behavior, such that, when __try/__finally make it to the standards,
> and/or people realize it was a mistake to not put it in in the first
> place, it's easy to rearrange code to take advantage of this.
> 
> I'd much rather introduce a feature that *could* actually be used to
> implement __try/__finally by means of preprocessor macros.  I'd love
> to be proved wrong, but I can't see how this proposal would enable
> this use :-(

I think I don't understand the logic which permits
__attribute__((cleanup)) but not try/finally.  The primary difference
is that the attribute uses a nonstandard syntax which we already have
instead of introducing a new one (which other vendors have). 
Conceptually, they exercise the same behavior, except that the cleanup
is restricted to being a function call instead of living in the local
scope.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]