git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Duy Nguyen <pclouds@gmail.com>
Cc: "Christian Couder" <christian.couder@gmail.com>,
	"Johannes Sixt" <j6t@kdbg.org>, git <git@vger.kernel.org>,
	"Junio C Hamano" <gitster@pobox.com>, "Jeff King" <peff@peff.net>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Karsten Blees" <karsten.blees@gmail.com>,
	"Stefan Beller" <sbeller@google.com>,
	"Matthieu Moy" <Matthieu.Moy@grenoble-inp.fr>,
	"Christian Couder" <chriscool@tuxfamily.org>
Subject: Re: [PATCH 80/83] run-command: make dup_devnull() non static
Date: Mon, 9 May 2016 17:05:08 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1605091700060.4092@virtualbox> (raw)
In-Reply-To: <CACsJy8DUcLWQ6AwyLE+CF+TxZtqDLS=82peizSf4TrZ3q=qjJg@mail.gmail.com>

Hi Duy,

On Sun, 8 May 2016, Duy Nguyen wrote:

> On Sun, May 8, 2016 at 1:33 PM, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> > The claim is that this libifies the procedure. But it makes the code
> > really nasty for use as a library: if this is run in a thread (and you
> > know that we are going to have to do this in the near future, for
> > performance reasons), it will completely mess up all the other threads
> > because it messes with the global file descriptors.
> 
> I vote one step at a time, leave multi-thread support for future.

Oh, but I never said that we have to do that now!

All I said was that using this dup() dance instead of truly libifying the
functions would slam the door almost shut for future multi-threading.
Which is a strong hint in my book that we should *not* do that dup()
dance, but fix our code by introducing a silent mode.

> There's a lot more shared state than file descriptors anyway, at least
> there are object db and index access and probably a couple of hidden
> static variables somewhere.

Sure. And do we change those shared states temporarily in our functions?
No, we don't. The object db is not made temporarily inaccessible while a
certain function runs. The index access is not temporarily disabled while
a certain function runs.

And this is what that dup() dance does: it disables *all* output, not only
from the current thread.

> And I'm not sure if multi-thread really helps here. Are we really
> CPU-bound? If object inflation causes that (wild guess), can we just
> inflate ahead in some separate process and pass the result back?

Again. I did *not* suggest to introduce multi-threading. I was making a
case for *avoiding* that ugly dup() to /dev/null and then dup() it back to
the original state. That would just ask for unintended side effects.

Ciao,
Dscho

  reply	other threads:[~2016-05-09 15:05 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-24 13:39 [PATCH 80/83] run-command: make dup_devnull() non static Christian Couder
2016-04-24 13:39 ` [PATCH 81/83] apply: roll back index in case of error Christian Couder
2016-04-25 16:06   ` Johannes Schindelin
2016-05-02  7:07     ` Johannes Schindelin
2016-05-02  7:18       ` Eric Sunshine
2016-05-03 12:57     ` Christian Couder
2016-04-24 13:39 ` [PATCH 82/83] environment: add set_index_file() Christian Couder
2016-05-03 15:36   ` Junio C Hamano
2016-05-04 11:50     ` Christian Couder
2016-04-24 13:39 ` [PATCH 83/83] builtin/am: use apply api in run_apply() Christian Couder
2016-04-25 15:03   ` Johannes Schindelin
2016-05-05 10:04     ` Christian Couder
2016-04-25 15:05 ` [PATCH 80/83] run-command: make dup_devnull() non static Johannes Schindelin
2016-05-05  9:50   ` Christian Couder
2016-05-05 20:07     ` Johannes Sixt
2016-05-06 13:56       ` Christian Couder
2016-05-06 15:34         ` Johannes Schindelin
2016-05-07 10:12           ` Christian Couder
2016-05-07 12:13             ` Johannes Schindelin
2016-05-07 13:46               ` Christian Couder
2016-05-08  6:33                 ` Johannes Schindelin
2016-05-08 10:15                   ` Duy Nguyen
2016-05-09 15:05                     ` Johannes Schindelin [this message]
2016-05-09 17:40                     ` 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

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

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1605091700060.4092@virtualbox \
    --to=johannes.schindelin@gmx.de \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=avarab@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=karsten.blees@gmail.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    --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.
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).