Interleaving pthread_cleanups in C and C++

Alexandre Oliva aoliva@redhat.com
Mon May 5 23:11:00 GMT 2003


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 :-(

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer



More information about the Gcc mailing list