pack-objects: remove #ifdef NO_PTHREADS
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Nov 3, 2018 at 09:48 UTC
9c897c5c2ad27d82b47472c967f675cad122aed3
2 files changed
+2
-30
builtin/pack-objects.c
+2
-24
@@ -1953,8 +1953,6 @@ static int delta_cacheable(unsigned long src_size, unsigned long trg_size,
1953
return 0;
1954
}
1955
1956
-#ifndef NO_PTHREADS
1957
-
1956
/* Protect access to object database */
1957
static pthread_mutex_t read_mutex;
1958
#define read_lock() pthread_mutex_lock(&read_mutex)
@@ -1979,16 +1977,6 @@ static pthread_mutex_t progress_mutex;
1977
* ahead in the list because they can be stolen and would need
1978
* progress_mutex for protection.
1979
*/
1982
-#else
1983
-
1984
-#define read_lock() (void)0
1985
-#define read_unlock() (void)0
1986
-#define cache_lock() (void)0
1987
-#define cache_unlock() (void)0
1988
-#define progress_lock() (void)0
1989
-#define progress_unlock() (void)0
1990
-
1991
-#endif
1980
1981
/*
1982
* Return the size of the object without doing any delta
@@ -2347,8 +2335,6 @@ static void find_deltas(struct object_entry **list, unsigned *list_size,
2335
free(array);
2336
}
2337
2350
-#ifndef NO_PTHREADS
2351
-
2338
static void try_to_free_from_threads(size_t size)
2339
{
2340
read_lock();
@@ -2578,10 +2564,6 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
2564
free(p);
2565
}
2566
2581
-#else
2582
-#define ll_find_deltas(l, s, w, d, p) find_deltas(l, &s, w, d, p)
2583
-#endif
2584
-
2567
static void add_tag_chain(const struct object_id *oid)
2568
{
2569
struct tag *tag;
@@ -2734,12 +2716,10 @@ static int git_pack_config(const char *k, const char *v, void *cb)
2716
if (delta_search_threads < 0)
2717
die(_("invalid number of threads specified (%d)"),
2718
delta_search_threads);
2737
-#ifdef NO_PTHREADS
2738
- if (delta_search_threads != 1) {
2719
+ if (!HAVE_THREADS && delta_search_threads != 1) {
2720
warning(_("no threads support, ignoring %s"), k);
2721
delta_search_threads = 0;
2722
}
2742
-#endif
2723
return 0;
2724
}
2725
if (!strcmp(k, "pack.indexversion")) {
@@ -3402,10 +3382,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
3382
if (!delta_search_threads) /* --threads=0 means autodetect */
3383
delta_search_threads = online_cpus();
3384
3405
-#ifdef NO_PTHREADS
3406
- if (delta_search_threads != 1)
3385
+ if (!HAVE_THREADS && delta_search_threads != 1)
3386
warning(_("no threads support, ignoring --threads"));
3408
-#endif
3387
if (!pack_to_stdout && !pack_size_limit)
3388
pack_size_limit = pack_size_limit_cfg;
3389
if (pack_to_stdout && pack_size_limit)
pack-objects.h
-6
@@ -145,9 +145,7 @@ struct packing_data {
145
struct packed_git **in_pack_by_idx;
146
struct packed_git **in_pack;
147
148
-#ifndef NO_PTHREADS
148
pthread_mutex_t lock;
150
-#endif
149
150
/*
151
* This list contains entries for bases which we know the other side
@@ -169,15 +167,11 @@ void prepare_packing_data(struct packing_data *pdata);
167
168
static inline void packing_data_lock(struct packing_data *pdata)
169
{
172
-#ifndef NO_PTHREADS
170
pthread_mutex_lock(&pdata->lock);
174
-#endif
171
}
172
static inline void packing_data_unlock(struct packing_data *pdata)
173
{
178
-#ifndef NO_PTHREADS
174
pthread_mutex_unlock(&pdata->lock);
180
-#endif
175
}
176
177
struct object_entry *packlist_alloc(struct packing_data *pdata,