From: John Keeping <john@keeping.me.uk>
To: Victor Leschuk <vleschuk@accesssoftek.com>
Cc: Victor Leschuk <vleschuk@gmail.com>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH v3] Add git-grep threads param
Date: Tue, 27 Oct 2015 11:52:56 +0000 [thread overview]
Message-ID: <20151027115256.GQ19802@serenity.lan> (raw)
In-Reply-To: <6AE1604EE3EC5F4296C096518C6B77EE5D0FDAB9FC@mail.accesssoftek.com>
On Mon, Oct 26, 2015 at 10:25:41PM -0700, Victor Leschuk wrote:
> >> @@ -22,6 +22,7 @@ SYNOPSIS
> >> [--color[=<when>] | --no-color]
> >> [--break] [--heading] [-p | --show-function]
> >> [-A <post-context>] [-B <pre-context>] [-C <context>]
> >> + [--threads <num>]
>
> > Is this the best place for this option? I know the current list isn't
> > sorted in any particular way, but here you're splitting up the set of
> > context options (`-A`, `-B`, `-C` and `-W`).
>
> Agree, I'll move the option both here and in documentation.
>
> >> -static int wait_all(void)
> >> +static int wait_all(struct grep_opt *opt)
>
> > I'm not sure passing a grep_opt in here is the cleanest way to do this.
> > Options are a UI concept and all we care about here is the number of
> > threads.
>
> > Since `threads` is a global, shouldn't the number of threads be a global
> > as well? Could we reuse `use_threads` here (possibly renaming it
> > `num_threads`)?
>
> This thought also crossed my mind, however we already pass grep_opt to
> start_threads() function, so I think passing it to wait_all() is not
> that ugly, and kind of symmetric. And I do not like the idea of
> duplicating same information in different places. What do you think?
The grep_opt in start_threads() is being passed through to run(), so it
seems slightly different to me. If the threads were being setup in
grep.c (as opposed to builtin/grep.c) then I'd agree that it belongs in
grep_opt, but since this is local to this particular user of the grep
infrastructure adding num_threads to the grep_opt structure at all feels
wrong to me.
Note that I wasn't suggesting passing num_threads as a parameter to
wait_all(), but rather having it as global state that is accessed by
wait_all() in the same way as the `threads` array.
If we rename use_threads to num_threads and just use that, then we only
have the information in one place don't we?
next prev parent reply other threads:[~2015-10-27 11:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-26 12:32 [PATCH v3] Add git-grep threads param Victor Leschuk
2015-10-26 19:32 ` John Keeping
2015-10-27 5:25 ` Victor Leschuk
2015-10-27 11:52 ` John Keeping [this message]
2015-10-27 13:54 ` Victor Leschuk
2015-10-27 14:11 ` John Keeping
[not found] ` <CA+55aFwrU25x25XrRODgS1oRXqN60rmYPiXLgfs3mqRco4Oi9A@mail.gmail.com>
2015-10-27 9:14 ` Victor Leschuk
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=20151027115256.GQ19802@serenity.lan \
--to=john@keeping.me.uk \
--cc=git@vger.kernel.org \
--cc=vleschuk@accesssoftek.com \
--cc=vleschuk@gmail.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.
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).