pthread_exit behavior from main

Godmar Back godmar@gmail.com
Fri Oct 5 01:53:00 GMT 2012


On Thu, Oct 4, 2012 at 9:51 PM, Carlos O'Donell <carlos@systemhalted.org> wrote:
> On Thu, Oct 4, 2012 at 9:41 PM, Godmar Back <godmar@gmail.com> wrote:
>> On Thu, Oct 4, 2012 at 9:09 PM, Carlos O'Donell <carlos@systemhalted.org> wrote:
>>>
>>> You are seeing the undefined results of reading memory that the
>>> runtime has marked with madvise as MADV_DONTNEED.
>>>
>>
>> Just out of curiosity, why do you madvise it with MADV_DONTNEED rather
>> than munmapping it outright?
>
> That's a very good question and I don't have a good answer.

I'm going to guess that perhaps calling munmap on your current stack
would pull the exiting thread's rug under its feets, so might have to
be coded in assembly language to ensure there are no stack accesses
between the unmap call and the pthread_exit() call.

 - Godmar



More information about the Libc-help mailing list