Initializing initial bottom of stack variable in pthread.c

Jay anonymous j2list468@yahoo.com
Fri Jul 28 22:10:00 GMT 2006


I downloaded glibc-linuxthreads-2.3.6.tar.gz and took
a look at the __pthread_initial_thread_bos variable in
pthread_initialize for the case when the stack grows
down (line 534).  My first question is why is is it
initializing for at least STACK_SIZE bytes below the
current stack address?  Is this to account for the
stack for the initial thread & the stack for the
manager thread?  My second question is why the 2 *
STACK_SIZE in the computation?  Since the stack is
growing down and the computation consists of the &
~(STACK_SIZE - 1), this actually initializes the
variable to 3 * STACK_SIZE from the top.  Is this
correct?

line 534:
__pthread_initial_thread_bos =
    (char *)(((long)CURRENT_STACK_FRAME - 2 *
STACK_SIZE) & ~(STACK_SIZE - 1));

Thanks

Jay

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Libc-alpha mailing list