title: Specifying thread stack size in pthreads
body: <p>I want to increase the stack size of a thread created through pthread_create(). The way to go seems to be</p>
  
  <pre><code>int pthread_attr_setstack( pthread_attr_t *attr,
                             void *stackaddr,
                             size_t stacksize ); 
  </code></pre>
  
  <p>from <code>pthread.h</code>.</p>
  
  <p>However, according to multiple online <a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_attr_setstack.html" rel="nofollow">references</a>,</p>
  
  <blockquote>
    <p>The stackaddr shall be aligned appropriately to be used as a stack; for example, pthread_attr_setstack() may fail with [EINVAL] if ( stackaddr &amp; 0x7) is not 0.</p>
  </blockquote>
  
  <p>My question: could someone provide an example of how to perform the alignment? Is it (the alignment) platform or implementation dependent?</p>
  
  <p>Thanks in advance</p>