git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Kyle McKay <mackyle@gmail.com>
Cc: git@vger.kernel.org, David Rothenberger <daveroth@acm.org>,
	Petr Baudis <pasky@ucw.cz>, Daniel Shahaf <danielsh@apache.org>
Subject: Re: [PATCH 1/2] Git.pm: add new temp_is_locked function
Date: Sat, 6 Jul 2013 17:11:48 -0700	[thread overview]
Message-ID: <20130707001148.GD30132@google.com> (raw)
In-Reply-To: <D34E9C76-89B8-44E6-B364-C71B2FC2AC52@gmail.com>

Hi,

Kyle McKay wrote:

> The temp_is_locked function can be used to determine whether
> or not a given name previously passed to temp_acquire is
> currently locked.
[...]
> +=item temp_is_locked ( NAME )
> +
> +Returns true if the file mapped to C<NAME> is currently locked.
> +
> +If true is returned, an attempt to C<temp_acquire()> the same
> C<NAME> will
> +throw an error.

Looks like this was line-wrapped somewhere in transit.

More importantly, it's not obvious from the above description what
this function will do.  What is a typical value of NAME?  Is it a
filename, an arbitrary string, a reference, or something else?  Is
this a way of checking if a file is flocked?  What is a typical way to
use this function?

Looking more closely, it looks like this is factoring out the idiom
for checking if a name is already in use from the _temp_cache
function.  Would it make sense for _temp_cache to call this helper?

When is a caller expected to call this function?  What guarantees can
the caller rely on?  After a call to temp_acquire(NAME), will
temp_is_locked(NAME) always return true until temp_release(NAME) is
called?  Does this only work within the context of a single process or
can locks persist beyond a process lifetime?  Do locks ever need to be
broken?

I didn't spend a lot of time trying to find the answers to these
questions because I want to make sure that people using Git.pm in the
future similarly do not have to spend a lot of time.  So hopefully a
documentation change could fix this.

Thanks and hope that helps,
Jonathan

      reply	other threads:[~2013-07-07  0:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-06  3:42 [PATCH 1/2] Git.pm: add new temp_is_locked function Kyle McKay
2013-07-07  0:11 ` Jonathan Nieder [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130707001148.GD30132@google.com \
    --to=jrnieder@gmail.com \
    --cc=danielsh@apache.org \
    --cc=daveroth@acm.org \
    --cc=git@vger.kernel.org \
    --cc=mackyle@gmail.com \
    --cc=pasky@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).