Date: Wed, 11 May 2005 22:28:51 -0500 From: Jonathan Noack <noackjr@alumni.rice.edu> To: Daniel Eischen <deischen@freebsd.org> Cc: stable@freebsd.org Subject: Re: PTHREAD_INVARIANTS in 5.x Message-ID: <4282CD73.1040303@alumni.rice.edu> In-Reply-To: <Pine.GSO.4.43.0505112240280.12550-100000@sea.ntplx.net> References: <Pine.GSO.4.43.0505112240280.12550-100000@sea.ntplx.net>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig3B1B1BB64F15A2D3AC407303 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 05/11/05 21:53, Daniel Eischen wrote: > On Wed, 11 May 2005, Jonathan Noack wrote: >>I checked out _PTHREADS_INVARIANTS for libthr and libpthread on CURRENT. >> As far as I can tell, all but one of the defines under >>_PTHREADS_INVARIANTS are ASSERTs; they check for a condition and if it >>is false result in a fatal error. These should be very visible if they >>are being tripped. Only MUTEX_INIT_LINK actually *does* something. It >>is defined in src/lib/libpthread/thread/thr_mutex.c at lines 43-46 and >>in src/lib/libthr/thread/thr_mutex.c at lines 44-47: >> >>#define MUTEX_INIT_LINK(m) do { \ >> (m)->m_qe.tqe_prev = NULL; \ >> (m)->m_qe.tqe_next = NULL; \ >>} while (0) >> >>I'm not sure what impact removing this explicit initialization would >>have. If we're not seeing fatal errors, everything else is just slowing >>us down. Assuming we feel our thread implementations are production >>worthy, we should disable these checks for releases. That is, unless I >>am missing something... > > I wrote the darn things, and they are useful in that they can > provide useful information if there are bugs and also for > detecting if the application is linked to multiple thread > libraries. For the init links macro, it is only used when > the mutex is initialized and on unlock. It's two instructions. > The others are also just a couple of instructions and shouldn't > be called often. > > This is way overblown and they're other areas for much > better optimizations than worrying about a couple of > instructions. Perhaps if it were called _PTHREAD_ROBUST > instead of _PTHREAD_INVARIANTS, noone would notice ;-) So I *was* missing something: the Big Picture. Detecting if an application is linked to multiple thread libraries is definitely a keeper. When I see your name in an email, the hash that is my brain returns "threads guy". Your previous responses to this topic (which my brain referenced as authoritative) seemed to indicate that you weren't sure and further investigation was necessary, so I looked into it. Sorry if I misunderstood that. > That's the last I'll say. re@ can do whatever they want > with my blessing. Fair enough. -- Jonathan Noack | noackjr@alumni.rice.edu | OpenPGP: 0x991D8195 --------------enig3B1B1BB64F15A2D3AC407303 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCgs13UFz01pkdgZURAmgUAJ0YlYkHCsbt5UvWkSQ6gQukRpdRaQCg3BP4 HHGW+Fv/DVAamjH9QStfx7g= =BsIW -----END PGP SIGNATURE----- --------------enig3B1B1BB64F15A2D3AC407303--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4282CD73.1040303>