1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-02 16:26:10 +02:00

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>
This commit is contained in:
Nguyễn Thái Ngọc Duy 2012-05-06 19:31:56 +07:00 committed by Junio C Hamano
parent b8a2486f15
commit b038a61020

View File

@ -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;