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]

Re: Calling other functions while concurrently calling exit?


On 09/19/2015 09:54 PM, Martin Sebor wrote:
> On 09/18/2015 09:06 PM, Carlos O'Donell wrote:
>> Is it spelled out anywhere in POSIX or ISO C that calling
>> other functions concurrently with exit is going to result
>> in undefined behaviour?
> 
> 7.1.4 Use of library functions of C11 requires library functions
> to avoid data races. So a program can safely call exit in one
> thread and whatever other standard C function other than exit
> or quick_exit in another thread.
> 
>>
>> It's obvious this is dangerous. There is global state being
>> shtudown and freed while threads are trying to use that
>> global state. However, I can't find anything that explicitly
>> forbids this.
>>
>> Is it simply that one must read "Consequences of Process
>> Termination" and imply that problems might be caused by this?
>>
>> It isn't entirely obvious that you can't have a thread call
>> dlclose while main calls exit.
> 
> I believe that's allowed by POSIX.

I silently expected this to be the case.

Rich already has a bug for this here:

https://sourceware.org/bugzilla/show_bug.cgi?id=14697

Cheers,
Carlos.


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