From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: "git\@vger.kernel.org" <git@vger.kernel.org>,
Brandon Williams <bmwill@google.com>
Subject: Re: [RFC/PATCH] attr: Document a new possible thread safe API
Date: Wed, 05 Oct 2016 10:00:27 -0700 [thread overview]
Message-ID: <xmqq8tu2ras4.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <CAGZ79kaFx++yipGmq=D2EPN4Gw9JhRXf_i4pFivTnkJmJXjFfg@mail.gmail.com> (Stefan Beller's message of "Tue, 4 Oct 2016 16:25:27 -0700")
Stefan Beller <sbeller@google.com> writes:
> I thought about that, but as I concluded that the get_all_attrs doesn't need
> conversion to a threading environment, we can keep it as is.
I agree that it is OK for get_all_attrs() to use its own way to ask
a question and receive an answer to it, that is different from how
git_check_attr() asks its question. The threading-support for it is
an unrelated issue, though (not that I think it needs to be run from
a multi-threaded caller).
>> ... I'd expect the most
>> typical caller to be
>>
>> static struct git_attr_check *check;
>> struct git_attr_result result[2]; /* we want two */
>>
>> git_attr_check_initl(&check, "crlf", "ident", NULL);
>> git_check_attr(path, check, result);
>> /* result[0] has "crlf", result[1] has "ident" */
>>
>> or something like that.
>
> I see, that seems to be a clean API. So git_attr_check_initl
> will lock the mutex and once it got the mutex it can either
> * return early as someone else did the work
> * needs to do the actual work
> and then unlock. In any case the work was done.
>
> git_check_attr, which runs in all threads points to the same check,
> but gets the different results.
Yeah, something along that line. It seems that we are now on the
same page?
Thanks.
next prev parent reply other threads:[~2016-10-05 17:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-04 22:14 [RFC/PATCH] attr: Document a new possible thread safe API Stefan Beller
2016-10-04 23:13 ` Junio C Hamano
2016-10-04 23:25 ` Stefan Beller
2016-10-05 17:00 ` Junio C Hamano [this message]
2016-10-05 17:04 ` Stefan Beller
2016-10-05 22:09 ` Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq8tu2ras4.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=sbeller@google.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).