This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Initializing initial bottom of stack variable in pthread.c


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 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]