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

Re: [PATCH 1/2] Fix config lockfile handling.

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 14, 2007, 21:18 UTC
Message-ID
<7vwsrhotzt.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<Pine.LNX.4.64.0712142015240.27959@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 6 quoted lines
>> > AFAICT this cannot work.  At least not reliably.  An atexit() handler 
>> > will access all (even closed) lockfiles.
>> 
>> Correct.  It cannot be on the stack.
>
> Note that this behaviour will be another obstacle to libification.

By your definition of "obstacle", there is no work at all in libification if the system is obstacle free.

Libification is all about removing run-once-and-exit and atexit() is just a part of it.

I think we can do this step-by-step by first introducing a new function "get_lockfile()" that takes a list of active lockfiles (perhaps that would be a part of "client context" thing in the library) and gives back a lockfile structure allocated on heap, registers it to the list of lockfiles that need to be eventually cleaned up, and another function "rollback_lockfiles()" that take the list of lockfiles in the "client context" and rolls them all back. Once there is such a "client contex", in the current unlibified "main" routines can then declare a global client context, obtain and use lockfiles for that context, and directly call rollback_lockfiles() from the atexit() handler.

But that is all post 1.5.4.
Previous: Johannes SchindelinNext: Johannes Sixt
Message 7 of 8 in “config.c fixes”
  1. Kristian HøgsbergDec 14, 2007
  2. 1/2 Fix config lockfile handling.Kristian Høgsberg, Dec 14, 2007
  3. 2/2 Use a strbuf for building up section header and key/value pair strings.Kristian Høgsberg, Dec 14, 2007
  4. Johannes SchindelinDec 14, 2007
  5. Junio C HamanoDec 14, 2007
  6. Johannes SchindelinDec 14, 2007
  7. Junio C HamanoDec 14, 2007
  8. Johannes SixtDec 14, 2007

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.