Am 22.08.2016 um 17:19 schrieb Richard Henderson:
On 08/22/2016 06:04 AM, Peter Lieven wrote:
+static size_t adjust_stack_size(size_t sz)
+{
+#ifdef _SC_THREAD_STACK_MIN
+    /* avoid stacks smaller than _SC_THREAD_STACK_MIN */
+    sz = MAX(MAX(sysconf(_SC_THREAD_STACK_MIN), 0), sz);
+#endif

You need to place the sysconf result into a local variable.  What you have now 
expands to 4 invocations of the function.

okay, I thought it would only be 2 calls and its not critical. but I can change 
that.


You might also consider passing in the pagesize, since you've already called 
getpagesize in one of the two users of this function.

I can change this as well, but isn't getpagesize just a macro on most systems?
If the call of getpagesize is critical we should cache it somewhere as there 
are more critical sections that call it repeatly.

Peter


Reply via email to