@matheusbsbs / matheus-bagliano / commits / 7eb151d6e2
Fork 0

Make NO_PTHREADS the sole thread configuration variable

When the first piece of threaded code was introduced in commit 8ecce684, it came with its own THREADED_DELTA_SEARCH Makefile option. Since this time, more threaded code has come into the codebase and a NO_PTHREADS option has also been added. Get rid of the original option as the newer, more generic option covers everything we need. Signed-off-by: Dan McGee <dpmcgee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Dan McGee committed Jan 29, 2010 at 19:22 UTC 7eb151d6e289b98d2ad3d1a9ad08fe3693f05a24
5 files changed +13 -36
Documentation/RelNotes-1.7.0.txt
+3
@@ -175,6 +175,9 @@ Updates since v1.6.6
175
176 * Many more commands are now built-in.
177
178 + * THREADED_DELTA_SEARCH is no more. If you build with threads, delta
179 + compression will always take advantage of it.
180 +
181 Fixes since v1.6.6
182 ------------------
183
Makefile
+2 -22
@@ -180,9 +180,6 @@ all::
180 # If not set it defaults to the bare 'wish'. If it is set to the empty
181 # string then NO_TCLTK will be forced (this is used by configure script).
182 #
183 -# Define THREADED_DELTA_SEARCH if you have pthreads and wish to exploit
184 -# parallel delta searching when packing objects.
185 -#
183 # Define INTERNAL_QSORT to use Git's implementation of qsort(), which
184 # is a simplified version of the merge sort used in glibc. This is
185 # recommended if Git triggers O(n^2) behavior in your platform's qsort().
@@ -722,12 +719,10 @@ EXTLIBS =
719 ifeq ($(uname_S),Linux)
720 NO_STRLCPY = YesPlease
721 NO_MKSTEMPS = YesPlease
725 - THREADED_DELTA_SEARCH = YesPlease
722 endif
723 ifeq ($(uname_S),GNU/kFreeBSD)
724 NO_STRLCPY = YesPlease
725 NO_MKSTEMPS = YesPlease
730 - THREADED_DELTA_SEARCH = YesPlease
726 endif
727 ifeq ($(uname_S),UnixWare)
728 CC = cc
@@ -781,7 +776,6 @@ ifeq ($(uname_S),Darwin)
776 NO_STRLCPY = YesPlease
777 endif
778 NO_MEMMEM = YesPlease
784 - THREADED_DELTA_SEARCH = YesPlease
779 USE_ST_TIMESPEC = YesPlease
780 endif
781 ifeq ($(uname_S),SunOS)
@@ -794,7 +788,6 @@ ifeq ($(uname_S),SunOS)
788 NO_MKDTEMP = YesPlease
789 NO_MKSTEMPS = YesPlease
790 NO_REGEX = YesPlease
797 - THREADED_DELTA_SEARCH = YesPlease
791 ifeq ($(uname_R),5.7)
792 NEEDS_RESOLV = YesPlease
793 NO_IPV6 = YesPlease
@@ -850,7 +843,6 @@ ifeq ($(uname_S),FreeBSD)
843 BASIC_LDFLAGS += -L/usr/local/lib
844 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
845 USE_ST_TIMESPEC = YesPlease
853 - THREADED_DELTA_SEARCH = YesPlease
846 ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
847 PTHREAD_LIBS = -pthread
848 NO_UINTMAX_T = YesPlease
@@ -864,7 +856,6 @@ ifeq ($(uname_S),OpenBSD)
856 NEEDS_LIBICONV = YesPlease
857 BASIC_CFLAGS += -I/usr/local/include
858 BASIC_LDFLAGS += -L/usr/local/lib
867 - THREADED_DELTA_SEARCH = YesPlease
859 endif
860 ifeq ($(uname_S),NetBSD)
861 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
@@ -872,7 +863,6 @@ ifeq ($(uname_S),NetBSD)
863 endif
864 BASIC_CFLAGS += -I/usr/pkg/include
865 BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
875 - THREADED_DELTA_SEARCH = YesPlease
866 USE_ST_TIMESPEC = YesPlease
867 NO_MKSTEMPS = YesPlease
868 endif
@@ -887,9 +877,7 @@ ifeq ($(uname_S),AIX)
877 INTERNAL_QSORT = UnfortunatelyYes
878 NEEDS_LIBICONV=YesPlease
879 BASIC_CFLAGS += -D_LARGE_FILES
890 - ifneq ($(shell expr "$(uname_V)" : '[1234]'),1)
891 - THREADED_DELTA_SEARCH = YesPlease
892 - else
880 + ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
881 NO_PTHREADS = YesPlease
882 endif
883 endif
@@ -915,7 +903,6 @@ ifeq ($(uname_S),IRIX)
903 SNPRINTF_RETURNS_BOGUS = YesPlease
904 SHELL_PATH = /usr/gnu/bin/bash
905 NEEDS_LIBGEN = YesPlease
918 - THREADED_DELTA_SEARCH = YesPlease
906 endif
907 ifeq ($(uname_S),IRIX64)
908 NO_SETENV=YesPlease
@@ -934,7 +921,6 @@ ifeq ($(uname_S),IRIX64)
921 SNPRINTF_RETURNS_BOGUS = YesPlease
922 SHELL_PATH=/usr/gnu/bin/bash
923 NEEDS_LIBGEN = YesPlease
937 - THREADED_DELTA_SEARCH = YesPlease
924 endif
925 ifeq ($(uname_S),HP-UX)
926 NO_IPV6=YesPlease
@@ -984,7 +970,6 @@ ifeq ($(uname_S),Windows)
970 NO_CURL = YesPlease
971 NO_PYTHON = YesPlease
972 BLK_SHA1 = YesPlease
987 - THREADED_DELTA_SEARCH = YesPlease
973
974 CC = compat/vcbuild/scripts/clink.pl
975 AR = compat/vcbuild/scripts/lib.pl
@@ -1036,7 +1021,6 @@ ifneq (,$(findstring MINGW,$(uname_S)))
1021 NO_REGEX = YesPlease
1022 NO_PYTHON = YesPlease
1023 BLK_SHA1 = YesPlease
1039 - THREADED_DELTA_SEARCH = YesPlease
1024 COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/fnmatch -Icompat/win32
1025 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
1026 COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/winansi.o \
@@ -1334,16 +1318,12 @@ ifdef RUNTIME_PREFIX
1318 endif
1319
1320 ifdef NO_PTHREADS
1337 - THREADED_DELTA_SEARCH =
1321 BASIC_CFLAGS += -DNO_PTHREADS
1322 else
1323 EXTLIBS += $(PTHREAD_LIBS)
1341 -endif
1342 -
1343 -ifdef THREADED_DELTA_SEARCH
1344 - BASIC_CFLAGS += -DTHREADED_DELTA_SEARCH
1324 LIB_OBJS += thread-utils.o
1325 endif
1326 +
1327 ifdef DIR_HAS_BSD_GROUP_SEMANTICS
1328 COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
1329 endif
builtin-pack-objects.c
+6 -6
@@ -17,7 +17,7 @@
17 #include "progress.h"
18 #include "refs.h"
19
20 -#ifdef THREADED_DELTA_SEARCH
20 +#ifndef NO_PTHREADS
21 #include "thread-utils.h"
22 #include <pthread.h>
23 #endif
@@ -1255,7 +1255,7 @@ static int delta_cacheable(unsigned long src_size, unsigned long trg_size,
1255 return 0;
1256 }
1257
1258 -#ifdef THREADED_DELTA_SEARCH
1258 +#ifndef NO_PTHREADS
1259
1260 static pthread_mutex_t read_mutex;
1261 #define read_lock() pthread_mutex_lock(&read_mutex)
@@ -1380,7 +1380,7 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
1380 /*
1381 * Handle memory allocation outside of the cache
1382 * accounting lock. Compiler will optimize the strangeness
1383 - * away when THREADED_DELTA_SEARCH is not defined.
1383 + * away when NO_PTHREADS is defined.
1384 */
1385 free(trg_entry->delta_data);
1386 cache_lock();
@@ -1567,7 +1567,7 @@ static void find_deltas(struct object_entry **list, unsigned *list_size,
1567 free(array);
1568 }
1569
1570 -#ifdef THREADED_DELTA_SEARCH
1570 +#ifndef NO_PTHREADS
1571
1572 /*
1573 * The main thread waits on the condition that (at least) one of the workers
@@ -1899,7 +1899,7 @@ static int git_pack_config(const char *k, const char *v, void *cb)
1899 if (delta_search_threads < 0)
1900 die("invalid number of threads specified (%d)",
1901 delta_search_threads);
1902 -#ifndef THREADED_DELTA_SEARCH
1902 +#ifdef NO_PTHREADS
1903 if (delta_search_threads != 1)
1904 warning("no threads support, ignoring %s", k);
1905 #endif
@@ -2227,7 +2227,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
2227 delta_search_threads = strtoul(arg+10, &end, 0);
2228 if (!arg[10] || *end || delta_search_threads < 0)
2229 usage(pack_usage);
2230 -#ifndef THREADED_DELTA_SEARCH
2230 +#ifdef NO_PTHREADS
2231 if (delta_search_threads != 1)
2232 warning("no threads support, "
2233 "ignoring %s", arg);
config.mak.in
-1
@@ -56,5 +56,4 @@ NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
56 FREAD_READS_DIRECTORIES=@FREAD_READS_DIRECTORIES@
57 SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@
58 NO_PTHREADS=@NO_PTHREADS@
59 -THREADED_DELTA_SEARCH=@THREADED_DELTA_SEARCH@
59 PTHREAD_LIBS=@PTHREAD_LIBS@
configure.ac
+2 -7
@@ -762,10 +762,9 @@ AC_SUBST(NO_MKSTEMPS)
762 # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
763 # Enable it on Windows. By default, symrefs are still used.
764 #
765 -# Define NO_PTHREADS if we do not have pthreads
765 +# Define NO_PTHREADS if we do not have pthreads.
766 #
767 -# Define PTHREAD_LIBS to the linker flag used for Pthread support and define
768 -# THREADED_DELTA_SEARCH if Pthreads are available.
767 +# Define PTHREAD_LIBS to the linker flag used for Pthread support.
768 AC_DEFUN([PTHREADTEST_SRC], [
769 #include <pthread.h>
770
@@ -782,7 +781,6 @@ dnl [[pthread_mutex_t test_mutex;]]
781 dnl )])
782
783 NO_PTHREADS=UnfortunatelyYes
785 -THREADED_DELTA_SEARCH=
784 PTHREAD_LIBS=
785
786 if test -n "$USER_NOPTHREAD"; then
@@ -798,7 +796,6 @@ elif test -z "$PTHREAD_CFLAGS"; then
796 [AC_MSG_RESULT([yes])
797 NO_PTHREADS=
798 PTHREAD_LIBS="$opt"
801 - THREADED_DELTA_SEARCH=YesPlease
799 break
800 ],
801 [AC_MSG_RESULT([no])])
@@ -812,7 +809,6 @@ else
809 [AC_MSG_RESULT([yes])
810 NO_PTHREADS=
811 PTHREAD_LIBS="$PTHREAD_CFLAGS"
815 - THREADED_DELTA_SEARCH=YesPlease
812 ],
813 [AC_MSG_RESULT([no])])
814
@@ -823,7 +819,6 @@ CFLAGS="$old_CFLAGS"
819
820 AC_SUBST(PTHREAD_LIBS)
821 AC_SUBST(NO_PTHREADS)
826 -AC_SUBST(THREADED_DELTA_SEARCH)
822
823 ## Output files
824 AC_CONFIG_FILES(["${config_file}":"${config_in}":"${config_append}"])