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>
This commit is contained in:
parent
e8d405662f
commit
9c897c5c2a
@ -1953,8 +1953,6 @@ static int delta_cacheable(unsigned long src_size, unsigned long trg_size,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NO_PTHREADS
|
|
||||||
|
|
||||||
/* Protect access to object database */
|
/* Protect access to object database */
|
||||||
static pthread_mutex_t read_mutex;
|
static pthread_mutex_t read_mutex;
|
||||||
#define read_lock() pthread_mutex_lock(&read_mutex)
|
#define read_lock() pthread_mutex_lock(&read_mutex)
|
||||||
@ -1979,16 +1977,6 @@ static pthread_mutex_t progress_mutex;
|
|||||||
* ahead in the list because they can be stolen and would need
|
* ahead in the list because they can be stolen and would need
|
||||||
* progress_mutex for protection.
|
* progress_mutex for protection.
|
||||||
*/
|
*/
|
||||||
#else
|
|
||||||
|
|
||||||
#define read_lock() (void)0
|
|
||||||
#define read_unlock() (void)0
|
|
||||||
#define cache_lock() (void)0
|
|
||||||
#define cache_unlock() (void)0
|
|
||||||
#define progress_lock() (void)0
|
|
||||||
#define progress_unlock() (void)0
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the size of the object without doing any delta
|
* 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,
|
|||||||
free(array);
|
free(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NO_PTHREADS
|
|
||||||
|
|
||||||
static void try_to_free_from_threads(size_t size)
|
static void try_to_free_from_threads(size_t size)
|
||||||
{
|
{
|
||||||
read_lock();
|
read_lock();
|
||||||
@ -2578,10 +2564,6 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
|
|||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
#define ll_find_deltas(l, s, w, d, p) find_deltas(l, &s, w, d, p)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void add_tag_chain(const struct object_id *oid)
|
static void add_tag_chain(const struct object_id *oid)
|
||||||
{
|
{
|
||||||
struct tag *tag;
|
struct tag *tag;
|
||||||
@ -2734,12 +2716,10 @@ static int git_pack_config(const char *k, const char *v, void *cb)
|
|||||||
if (delta_search_threads < 0)
|
if (delta_search_threads < 0)
|
||||||
die(_("invalid number of threads specified (%d)"),
|
die(_("invalid number of threads specified (%d)"),
|
||||||
delta_search_threads);
|
delta_search_threads);
|
||||||
#ifdef NO_PTHREADS
|
if (!HAVE_THREADS && delta_search_threads != 1) {
|
||||||
if (delta_search_threads != 1) {
|
|
||||||
warning(_("no threads support, ignoring %s"), k);
|
warning(_("no threads support, ignoring %s"), k);
|
||||||
delta_search_threads = 0;
|
delta_search_threads = 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!strcmp(k, "pack.indexversion")) {
|
if (!strcmp(k, "pack.indexversion")) {
|
||||||
@ -3402,10 +3382,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
|
|||||||
if (!delta_search_threads) /* --threads=0 means autodetect */
|
if (!delta_search_threads) /* --threads=0 means autodetect */
|
||||||
delta_search_threads = online_cpus();
|
delta_search_threads = online_cpus();
|
||||||
|
|
||||||
#ifdef NO_PTHREADS
|
if (!HAVE_THREADS && delta_search_threads != 1)
|
||||||
if (delta_search_threads != 1)
|
|
||||||
warning(_("no threads support, ignoring --threads"));
|
warning(_("no threads support, ignoring --threads"));
|
||||||
#endif
|
|
||||||
if (!pack_to_stdout && !pack_size_limit)
|
if (!pack_to_stdout && !pack_size_limit)
|
||||||
pack_size_limit = pack_size_limit_cfg;
|
pack_size_limit = pack_size_limit_cfg;
|
||||||
if (pack_to_stdout && pack_size_limit)
|
if (pack_to_stdout && pack_size_limit)
|
||||||
|
@ -145,9 +145,7 @@ struct packing_data {
|
|||||||
struct packed_git **in_pack_by_idx;
|
struct packed_git **in_pack_by_idx;
|
||||||
struct packed_git **in_pack;
|
struct packed_git **in_pack;
|
||||||
|
|
||||||
#ifndef NO_PTHREADS
|
|
||||||
pthread_mutex_t lock;
|
pthread_mutex_t lock;
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This list contains entries for bases which we know the other side
|
* This list contains entries for bases which we know the other side
|
||||||
@ -169,15 +167,11 @@ void prepare_packing_data(struct packing_data *pdata);
|
|||||||
|
|
||||||
static inline void packing_data_lock(struct packing_data *pdata)
|
static inline void packing_data_lock(struct packing_data *pdata)
|
||||||
{
|
{
|
||||||
#ifndef NO_PTHREADS
|
|
||||||
pthread_mutex_lock(&pdata->lock);
|
pthread_mutex_lock(&pdata->lock);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
static inline void packing_data_unlock(struct packing_data *pdata)
|
static inline void packing_data_unlock(struct packing_data *pdata)
|
||||||
{
|
{
|
||||||
#ifndef NO_PTHREADS
|
|
||||||
pthread_mutex_unlock(&pdata->lock);
|
pthread_mutex_unlock(&pdata->lock);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct object_entry *packlist_alloc(struct packing_data *pdata,
|
struct object_entry *packlist_alloc(struct packing_data *pdata,
|
||||||
|
Loading…
Reference in New Issue
Block a user