From: Ian Campbell Subject: Re: [PATCH] xs: set read_thread stacksize Date: Wed, 30 May 2012 10:40:15 +0100 Message-ID: <1338370815.31698.26.camel@zakaz.uk.xensource.com> References: <0cf61ed6ce86de2b61db.1338307000@drall.uk.xensource.com> <4FC4FBAF.6040503@citrix.com> <1338320373.21683.22.camel@dagon.hellion.org.uk> <201205300856.15605.simon.rowe@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <201205300856.15605.simon.rowe@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Simon Rowe Cc: Roger Pau Monne , Ian Jackson , David Vrabel , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Wed, 2012-05-30 at 08:56 +0100, Simon Rowe wrote: > On Tuesday 29 May 2012 20:39:33 Ian Campbell wrote: > > > ...and if it were then autoconf is the way to figure that out now, > > unless _POSIX_THREAD_ATTR_STACKSIZE is specified somewhere (which I > > doubt). > > I was following the recommendation of the POSIX Threads: Semi-FAQ which states > > > 5.2 How can I determine if a system supports the Stack Attribute(s)? > > If the header file unistd.h defines the symbolic constant > _POSIX_THREAD_ATTR_STACKSIZE to a value greater than 0, the implementation > should support the getting and setting of the Stack Size Attribute. If it > defined to a value of 200112L then the current specification is supported. > > > If this needs to be done via autoconf let me know. If this little trick applies to both NetBSD and uclibc too then I guess it would be OK, otherwise I think autoconf is necessary. > > Also if it is only pthread_attr_setstacksize which is optional, rather > > than pthread_attr_* generally, then the #if could be pulled into just > > surround that call, presuming there is no harm in a "NULL" attr. > > I don't quite get you, do you mean only protect the actual > pthread_attr_setstacksize() call with #ifdef and therefore always call > pthread_attr_init()? Yes, that'll reduce the ifdeffery and inparticular removes the double if (pthread_create(&h->read_thr, NULL, read_thread, h) != 0) { in either half, which is bit tricky to follow and is going to be prone to drift across the two sides.