[arch-commits] Commit in glibc/trunk (locale-gen)

Allan McRae allan at nymeria.archlinux.org
Mon Oct 14 05:14:40 UTC 2013


    Date: Monday, October 14, 2013 @ 07:14:39
  Author: allan
Revision: 196450

limit parallel generation of locales

Modified:
  glibc/trunk/locale-gen

------------+
 locale-gen |    7 +++++++
 1 file changed, 7 insertions(+)

Modified: locale-gen
===================================================================
--- locale-gen	2013-10-14 00:53:21 UTC (rev 196449)
+++ locale-gen	2013-10-14 05:14:39 UTC (rev 196450)
@@ -35,6 +35,7 @@
 	localedef -i "$input" -c -f "$charset" -A /usr/share/locale/locale.alias "$locale"
 }
 
+maxjobs=$(grep -qc processor /proc/cpuinfo 2>/dev/null || echo 1)
 echo "Generating locales..."
 while read locale charset; do \
 	case $locale in
@@ -43,6 +44,12 @@
 			;;
 	esac
 	gen "$locale" "$charset" &
+
+	# keep no more than $maxjobs jobs in flight
+	while [ $(jobs | wc -l) -ge $maxjobs ]; do
+		sleep 0.25
+		jobs >/dev/null
+	done
 done < $LOCALEGEN
 wait
 




More information about the arch-commits mailing list