problem of stack size in st_thread_create()

Alfred Zhong <[email protected]> Wed, 10 Aug 2011 11:58:12 -0400
Newsgroups gmane.comp.lib.state-threads.announce
Message-ID <CAFU3TiKdoTQTSCFebn6tYqga-eFO+SJBrSr9+7rm6YiPgTErMg@mail.gmail.com>
--===============2590739011295609336==
Content-Type: multipart/alternative; boundary=bcaec519704b59d1f304aa28bf17

--bcaec519704b59d1f304aa28bf17
Content-Type: text/plain; charset=ISO-8859-1

Hi,
I am new to state thread library and am reading the source code of ST to
study implementation of threading.

in the st_thread_create() function

there is this code piece

if (stk_size == 0)
    stk_size = ST_DEFAULT_STACK_SIZE;  // I know this is to set the stack
size to a default size, if the input size is 0
  stk_size = ((stk_size + _ST_PAGE_SIZE - 1) / _ST_PAGE_SIZE) *
_ST_PAGE_SIZE; //what does this mean?

Look like it equals (stk_size + ST_PAGE_SIZE -1) unless the previous
division gives 0.

I am totally confused and can't find the answer in the code or the docs,
please help!

Thanks a lot!
Alfred

--bcaec519704b59d1f304aa28bf17
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi,<div>I am new to state thread library and am reading the source code of =
ST to study implementation of threading.=A0</div><div><br></div><div>in the=
 st_thread_create() function</div><div><br></div><div>there is this code pi=
ece</div>
<div><br></div><div><div>if (stk_size =3D=3D 0)</div><div>=A0 =A0 stk_size =
=3D ST_DEFAULT_STACK_SIZE; =A0// I know this is to set the stack size to a =
default size, if the input size is 0</div><div>=A0 stk_size =3D ((stk_size =
+ _ST_PAGE_SIZE - 1) / _ST_PAGE_SIZE) * _ST_PAGE_SIZE; //what does this mea=
n?</div>
</div><div><br></div><div>Look like it equals (stk_size + ST_PAGE_SIZE -1) =
unless the previous division gives 0.</div><div><br></div><div>I am totally=
 confused and can&#39;t find the answer in the code or the docs, please hel=
p!</div>
<div><br></div><div>Thanks a lot!</div><div>Alfred</div>

--bcaec519704b59d1f304aa28bf17--


--===============2590739011295609336==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev
--===============2590739011295609336==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
State-threads-announce mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/state-threads-announce

--===============2590739011295609336==--