Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Feb 2018 00:32:20 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r329255 - stable/11/usr.bin/sort
Message-ID:  <201802140032.w1E0WKKl009439@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Wed Feb 14 00:32:19 2018
New Revision: 329255
URL: https://svnweb.freebsd.org/changeset/base/329255

Log:
  MFC r328995:
  Fix the WITH_SORT_THREADS build.
  
  PR:	201664

Modified:
  stable/11/usr.bin/sort/radixsort.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/sort/radixsort.c
==============================================================================
--- stable/11/usr.bin/sort/radixsort.c	Wed Feb 14 00:31:45 2018	(r329254)
+++ stable/11/usr.bin/sort/radixsort.c	Wed Feb 14 00:32:19 2018	(r329255)
@@ -127,6 +127,14 @@ have_sort_left(void)
 
 #endif /* SORT_THREADS */
 
+static void
+_push_ls(struct level_stack *ls)
+{
+
+	ls->next = g_ls;
+	g_ls = ls;
+}
+
 /*
  * Push sort level to the stack
  */
@@ -139,22 +147,14 @@ push_ls(struct sort_level *sl)
 	new_ls->sl = sl;
 
 #if defined(SORT_THREADS)
-	if (nthreads > 1)
+	if (nthreads > 1) {
 		pthread_mutex_lock(&g_ls_mutex);
-#endif
-
-	new_ls->next = g_ls;
-	g_ls = new_ls;
-
-#if defined(SORT_THREADS)
-	if (nthreads > 1)
+		_push_ls(new_ls);
 		pthread_cond_signal(&g_ls_cond);
-#endif
-
-#if defined(SORT_THREADS)
-	if (nthreads > 1)
 		pthread_mutex_unlock(&g_ls_mutex);
+	} else
 #endif
+		_push_ls(new_ls);
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802140032.w1E0WKKl009439>