Skip to content
  • Duy Nguyen's avatar
    index-pack: work around thread-unsafe pread() · 39539495
    Duy Nguyen authored and Junio C Hamano's avatar Junio C Hamano committed
    Multi-threaing of index-pack was disabled with c0f86547
    (index-pack: Disable threading on cygwin - 2012-06-26), because
    pread() implementations for Cygwin and MSYS were not thread
    safe.  Recent Cygwin does offer usable pread() and we enabled
    multi-threading with 103d530f (Cygwin 1.7 has thread-safe pread,
    2013-07-19).
    
    Work around this problem on platforms with a thread-unsafe
    pread() emulation by opening one file handle per thread; it
    would prevent parallel pread() on different file handles from
    stepping on each other.
    
    Also remove NO_THREAD_SAFE_PREAD that was introduced in c0f86547
    
    
    because it's no longer used anywhere.
    
    This workaround is unconditional, even for platforms with
    thread-safe pread() because the overhead is small (a couple file
    handles more) and not worth fragmenting the code.
    
    Signed-off-by: default avatarNguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Tested-by: default avatarJohannes Sixt <j6t@kdbg.org>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    39539495