From: Alfred Z. <alf...@gm...> - 2011-08-10 16:06:10
|
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 |