Date: Wed, 8 Oct 2008 02:18:36 -0400 (EDT) From: Daniel Eischen <deischen@freebsd.org> To: Alfred Perlstein <alfred@freebsd.org> Cc: threads@freebsd.org, John Hein <jhein@timing.com> Subject: Re: pthread_cleanup_push & pthread_cleanup_pop usage Message-ID: <Pine.GSO.4.64.0810080215150.3378@sea.ntplx.net> In-Reply-To: <20081008045447.GY36572@elvis.mu.org> References: <18668.10465.699531.162573@gromit.timing.com> <20081008045447.GY36572@elvis.mu.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 7 Oct 2008, Alfred Perlstein wrote: > * John Hein <jhein@timing.com> [081007 21:45] wrote: >> In June pthread_cleanup_push & pthread_cleanup_pop were changed to macros >> that look like so... > > Hey John, I found the same problem when working on QNX a while back, > however that is really how it's supposed to be set up. > > I would suggest the following construct to fix the problem, > make your own per-thread stack of destructors that are callable > as functions and not macros. > > It's not too hard to do. > > Just use a pthread_key and pthread_once thingy to write a library > to do it, shouldn't take more than a hundred lines of code. > > FWIW, OS X and QNX have the same set of macros, not sure about > other OSes. Solaris as well. Just conditionally undef them before you use them. #ifdef pthread_cleanup_push #undef pthread_cleanup_push #endif #ifdef pthread_cleanup_pop #undef pthread_cleanup_pop #endif The library versions are still there (they have to be in order to be callable from non-C/C++ languages). -- DE
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.64.0810080215150.3378>