team.c (gomp_team_end): Free team immediately if it has just one thread.
authorJakub Jelinek <jakub@redhat.com>
Wed, 16 Jul 2008 15:35:26 +0000 (17:35 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 16 Jul 2008 15:35:26 +0000 (17:35 +0200)
* team.c (gomp_team_end): Free team immediately if it has
just one thread.

From-SVN: r137886

libgomp/ChangeLog
libgomp/team.c

index 671b48bde762e4823d2d0024690f78d15ad41726..ded506b063618b803d0148065fdc0d752bff44f0 100644 (file)
@@ -1,3 +1,8 @@
+2008-07-16  Jakub Jelinek  <jakub@redhat.com>
+
+       * team.c (gomp_team_end): Free team immediately if it has
+       just one thread.
+
 2008-07-08  David Edelsohn  <edelsohn@gnu.org>
 
        * testsuite/libgomp.c++/c++.exp: Append multilib library path.
index 18b02e72f902b3104da1f06a5d120dd06ae29998..224236c6604ea7aefefa95f9c822cae0a5230592 100644 (file)
@@ -498,7 +498,8 @@ gomp_team_end (void)
   gomp_mutex_destroy (&team->work_share_list_free_lock);
 #endif
 
-  if (__builtin_expect (thr->ts.team != NULL, 0))
+  if (__builtin_expect (thr->ts.team != NULL, 0)
+      || __builtin_expect (team->nthreads == 1, 0))
     free_team (team);
   else
     {