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

Re: [PATCH] compat: Allow static initializer for pthreads on Windows

From
Johannes Sixt <j6t@kdbg.org>
Date
Oct 28, 2016, 20:26 UTC
Message-ID
<38b70094-5550-8512-7735-a6739f435803@kdbg.org>
In-Reply-To
<CA+P7+xoyF8EG079eC-dfTSj+YrbxhPWx356-jZ90gDs6SwyppA@mail.gmail.com>
Am 28.10.2016 um 20:48 schrieb Jacob Keller:
Show 17 quoted lines
> On Fri, Oct 28, 2016 at 4:58 AM, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
>> Hi Jake,
>>
>> On Thu, 27 Oct 2016, Jacob Keller wrote:
>>
>>> I agree with Stefan that there isn't really a great place to put a
>>> dynamic initialization.
>>
>> Ummm. Wait. What???
>>
>> https://github.com/git/git/blob/v2.10.1/common-main.c#L25-L41
>
> I think Stefan has since provided a better suggestion of isolating the
> dynamic initialization into the MINGW startup section. However, you
> are right either place works, though I think platforms which support
> static initialization should use it.

It's a pity that this new patch introduces the first use of PTHREAD_MUTEX_INITILIZER. (I do not count the one in compat/nedmalloc, it's in platform specific code.) We have to introduce a dummy definition on Windows to even compile the code.

Now we have a double-edged sword: Other coders who are not aware of this thread might think it works. But it does not.

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.

-- Hannes
Previous: Jacob KellerNext: Junio C Hamano
Message 23 of 28 in “compat: Allow static initializer for pthreads on Windows”
  1. compat: Allow static initializer for pthreads on WindowsStefan Beller, Oct 26, 2016
  2. Stefan BellerOct 26, 2016
  3. Johannes SixtOct 27, 2016
  4. Junio C HamanoOct 27, 2016
  5. Johannes SixtOct 27, 2016
  6. Junio C HamanoOct 27, 2016
  7. Johannes SixtOct 27, 2016
  8. Junio C HamanoOct 27, 2016
  9. Stefan BellerOct 27, 2016
  10. Jeff KingOct 27, 2016
  11. Johannes SixtOct 27, 2016
  12. Junio C HamanoOct 27, 2016
  13. Stefan BellerOct 27, 2016
  14. Johannes SixtOct 27, 2016
  15. Jacob KellerOct 27, 2016
  16. Stefan BellerOct 27, 2016
  17. Johannes SixtOct 28, 2016
  18. Jacob KellerOct 28, 2016
  19. Philip OakleyOct 28, 2016
  20. Jacob KellerOct 28, 2016
  21. Johannes SchindelinOct 28, 2016
  22. Jacob KellerOct 28, 2016
  23. Johannes SixtOct 28, 2016
  24. Junio C HamanoOct 28, 2016
  25. Stefan BellerOct 28, 2016
  26. Junio C HamanoOct 28, 2016
  27. Johannes SixtOct 28, 2016
  28. Junio C HamanoOct 28, 2016

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.