Re: [PATCH] compat: Allow static initializer for pthreads on Windows
- From
Stefan Beller <sbeller@google.com>
- Date
- Oct 28, 2016, 20:36 UTC
- Message-ID
- <CAGZ79kZVivquVDH9S63K8p3bOis+e=b3cKVVrg13zPe_BrL_Sw@mail.gmail.com>
- In-Reply-To
- <xmqqr370z07v.fsf@gitster.mtv.corp.google.com>
On Fri, Oct 28, 2016 at 1:29 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
> Johannes Sixt <j6t@kdbg.org> writes: > >> Another problem with the proposed patch is that there is no >> declaration for attr_start() before the call in compat/mingw.c. We >> would have to move the declaration of attr_start() to cache.h (for >> example), because #including attr.h in compat/mingw.c is plainly >> wrong. However, it would not be a major offense to #include attr.h in >> common-main.c. But when we do that, we can certainly spare the few >> cycles to call pthread_mutex_init. > > That sounds like a good argument to have it in common-main.c.
If we're going that route, I would get rid of PTHREAD_MUTEX_INITILIZER and call a pthread_mutex_init platform independently.
Show 5 quoted lines
> > Would it mean that the code that defines the mutex needs to have > #ifdef that defines a no-op attr_start() and defines the mutex with > PTHREAD_MUTEX_INITILIZER with #else that just defines the mutex > without initializatin, with the real attr_start(), though?