aboutsummaryrefslogtreecommitdiff
path: root/builtin/index-pack.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2012-05-06 19:31:56 +0700
committerJunio C Hamano <gitster@pobox.com>2012-05-07 15:48:19 -0700
commitb038a61020573b1be6e5fc5b2be4485b63a9cbf1 (patch)
treeaa912176a94ea77819264969f30f905e98d1b1d6 /builtin/index-pack.c
parentb8a2486f1524947f232f657e9f2ebf44e3e7a243 (diff)
downloadgit-b038a61020573b1be6e5fc5b2be4485b63a9cbf1.tar.gz
git-b038a61020573b1be6e5fc5b2be4485b63a9cbf1.tar.xz
index-pack: disable threading if NO_PREAD is defined
NO_PREAD simulates pread() as a sequence of seek, read, seek in compat/pread.c. The simulation is not thread-safe because another thread could move the file offset away in the middle of pread operation. Do not allow threading in that case. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/index-pack.c')
-rw-r--r--builtin/index-pack.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index d4685c50d..807ee56f7 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -39,6 +39,11 @@ struct base_data {
int ofs_first, ofs_last;
};
+#if !defined(NO_PTHREADS) && defined(NO_PREAD)
+/* NO_PREAD uses compat/pread.c, which is not thread-safe. Disable threading. */
+#define NO_PTHREADS
+#endif
+
struct thread_local {
#ifndef NO_PTHREADS
pthread_t thread;