Re: Support pthread with no recursive mutex (SunOS 5.6)
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:49:58
Jonathan Nieder [off-list ref] writes:
Hi Gary, Gary V. Vaughan wrote:quoted
Thanks for merging my last patch series into the new release. git 1.7.3.2 now compiles correctly on all of our hosts, save Solaris 2.6 (SunOS 5.6) which has no recursive mutex support in its pthreads.Nice.quoted
--- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c@@ -1561,7 +1561,11 @@ static pthread_cond_t progress_cond; */ static void init_threaded_search(void) { +#ifndef NO_RECURSIVE_MUTEX init_recursive_mutex(&read_mutex); +#else + pthread_mutex_init(&read_mutex, NULL); +#endifWouldn't that defeat the purpose of using a recursive mutex in the first place?
Thanks for a sanity. What might make sense is not NO_RECURSIVE_MUTEX but MUTEX_IS_RECURSIVE (which would be the Windows case). If Solaris 2.6 has mutex without PTHREAD_MUTEX_RECURSIVE, and its mutex is already recursive without being told anything special, then something like the above patch (#ifdef should be in the definition of init_recursive_mutex() function, not its callsite, by the way) would be a good thing to have, but I somehow doubt that it would be the case...