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/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.

Martin


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