git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Support pthread with no recursive mutex (SunOS 5.6)

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 4, 2010, 15:01 UTC
Message-ID
<7vvd4duo9b.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20101102173510.GB5636@burratino>
Jonathan Nieder <jrnieder@gmail.com> writes:
Show 24 quoted lines
> Hi Gary,
>
> Gary V. Vaughan wrote:
>
>> 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.
>
>> --- 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);
>> +#endif
>
> Wouldn'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...

Previous: Jonathan Nieder
Message 3 of 3 in “Support pthread with no recursive mutex (SunOS 5.6)”
  1. Gary V. VaughanNov 2, 2010
  2. Jonathan NiederNov 2, 2010
  3. Junio C HamanoNov 4, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.