This is the mail archive of the
mailing list for the GCC project.
Re: libgomp: Purpose of gomp_thread_pool::last_team?
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 2 Jul 2015 22:22:42 +0200
- Subject: Re: libgomp: Purpose of gomp_thread_pool::last_team?
- Authentication-results: sourceware.org; auth=none
- References: <686832854 dot 203468 dot 1435867040815 dot JavaMail dot zimbra at embedded-brains dot de>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Jul 02, 2015 at 09:57:20PM +0200, Sebastian Huber wrote:
> does anyone know what the purpose of gomp_thread_pool::last_team is? This field seems to be used to delay the team destruction in gomp_team_end() in case the team has more than one thread and the previous team state has no team associated (identifies this a master thread?):
> if (__builtin_expect (thr->ts.team != NULL, 0)
> || __builtin_expect (team->nthreads == 1, 0))
> free_team (team);
> struct gomp_thread_pool *pool = thr->thread_pool;
> if (pool->last_team)
> free_team (pool->last_team);
> pool->last_team = team;
> Why can you not immediately free the team?
That was added with
and the purpose is for non-nested teams make sure all the
threads in the team move on to the pool's barrier before
the team's barrier is destroyed.