Policy on global variables
Lars Hjemli
hjemli at gmail.com
Thu Jan 16 09:06:51 CET 2014
On Thu, Jan 16, 2014 at 2:00 AM, Jason A. Donenfeld <Jason at zx2c4.com> wrote:
> On Thu, Jan 16, 2014 at 1:59 AM, Eric Wong <normalperson at yhbt.net> wrote:
>> This. I prefer we keep passing around the ctx variable to keep the code
>> more flexible for future reuse. Of course, IIRC git itself has this
>> limitation, too...
>
> Can anyone confirm or deny this? Is it a pointless endeavor because of
> git's design?
Supporting something like FCGI in cgit will require a fork(2) for each
request, before invoking libgit.a functions, since these functions are
not generally reentrant (they tend to use global state and/or
inconveniently die(3)).
Therefore, passing a pointer to a context variable serves no real
purpose since each request would be processed in a different child
process (thus having a private copy of the global context).
But FCGI support could still be a nice addition to cgit, since parsing
of cgitrc and/or scanning for repos could then be done once, in the
parent process.
--
larsh
More information about the CGit
mailing list