This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [PATCH] [libgomp] make it possible to use OMP on both sides of a fork


On Tue, Feb 18, 2014 at 8:58 PM, Richard Henderson <rth@redhat.com> wrote:
> On 02/16/2014 03:59 PM, Nathaniel Smith wrote:
>> Yes, but the problem is that depending on what the user intends to do
>> after forking, our pthread_atfork handler might help or it might hurt,
>> and we don't know which. Consider these two cases:
>>   - fork+exec
>>   - fork+continue to use OMP in child
>> The former case is totally POSIX-legal, even when performed at
>> arbitrary places, even when another thread is, say, in the middle of
>> calling malloc().
>
> Point well taken.

Hi all,

I guess this patch has gotten all the feedback that it's getting. Any
interest in committing it? :-) I don't have commit access.

2014-02-12  Nathaniel J. Smith  <njs@pobox.com>

        * team.c (gomp_free_pool_helper): Move per-thread cleanup to main
        thread.
        (gomp_free_thread): Delegate implementation to...
        (gomp_free_thread_pool): ...this new function. Like old
        gomp_free_thread, but does per-thread cleanup, and has option to
        skip everything that involves interacting with actual threads,
        which is useful when called after fork.
        (gomp_after_fork_callback): New function.
        (gomp_team_start): Register atfork handler, and check for fork on
        entry.

Cheers,
-n

-- 
Nathaniel J. Smith
Postdoctoral researcher - Informatics - University of Edinburgh
http://vorpus.org

Attachment: gomp-safe-fork-patch.diff
Description: Text document


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