problem of stack size in st_thread_create()
Alfred Zhong <[email protected]> Wed, 10 Aug 2011 12:06:00 -0400
| Newsgroups | gmane.comp.lib.state-threads.user,gmane.comp.lib.state-threads.devel |
|---|---|
| Message-ID | <CAFU3Ti+OEpKX9iq8urT4-pBe-qLdkHqCQ2wXDzTpZcAijPQSfA@mail.gmail.com> |
--===============8092856268505153973==
Content-Type: multipart/alternative; boundary=e0cb4e8874534148b204aa28db6e
--e0cb4e8874534148b204aa28db6e
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
--e0cb4e8874534148b204aa28db6e
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<span class=3D"Apple-style-span" style=3D"font-family: arial, sans-serif; f=
ont-size: 13px; background-color: rgb(255, 255, 255); ">Hi,<div>I am new to=
state thread library and am reading the source code of ST to study impleme=
ntation of threading.=A0</div>
<div><br></div><div>in the st_thread_create() function</div><div><br></div>=
<div>there is this code piece</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 kno=
w 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) * _S=
T_PAGE_SIZE; //what does this mean?</div></div><div><br></div><div>Look lik=
e 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't find the answer in =
the code or the docs, please help!</div><div><br></div><div>Thanks a lot!</=
div><div>Alfred</div></span>
--e0cb4e8874534148b204aa28db6e--
--===============8092856268505153973==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model
configuration take the hassle out of deploying and managing Subversion and
the tools developers use with it. Learn more about uberSVN and get a free
download at: http://p.sf.net/sfu/wandisco-dev2dev
--===============8092856268505153973==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
State-threads-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/state-threads-users
--===============8092856268505153973==--