From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Christian Couder" <christian.couder@gmail.com>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 3/5] read-cache: allow index-helper to prepare shm before git reads it
Date: Sun, 1 Nov 2015 14:55:44 +0100 [thread overview]
Message-ID: <1446386146-10438-4-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1446386146-10438-1-git-send-email-pclouds@gmail.com>
If index-helper puts 'W' before pid in $GIT_DIR/index-helper.pid, then
git will sleep for a while, expecting to be waken up by SIGUSR1 when
index-helper has done shm preparation, or after the timeout.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
read-cache.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/read-cache.c b/read-cache.c
index 893223e..ae33951 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1591,14 +1591,24 @@ static void do_poke(struct strbuf *sb, int refresh_cache)
PostMessage(hwnd, refresh_cache ? WM_USER : WM_USER + 1, 0, 0);
}
#else
+static void do_nothing(int sig)
+{
+}
+
static void do_poke(struct strbuf *sb, int refresh_cache)
{
- char *start = sb->buf;
+ int wait = sb->buf[0] == 'W';
+ char *start = wait ? sb->buf + 1 : sb->buf;
char *end = NULL;
pid_t pid = strtoul(start, &end, 10);
+ int ret;
if (!end || end != sb->buf + sb->len)
return;
- kill(pid, refresh_cache ? SIGHUP : SIGUSR1);
+ ret = kill(pid, refresh_cache ? SIGHUP : SIGUSR1);
+ if (!refresh_cache && !ret && wait) {
+ signal(SIGHUP, do_nothing);
+ sleep(1);
+ }
}
#endif
--
2.2.0.513.g477eb31
next prev parent reply other threads:[~2015-11-01 13:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-01 13:55 [PATCH 0/5] Use watchman to reduce index refresh time Nguyễn Thái Ngọc Duy
2015-11-01 13:55 ` [PATCH 1/5] read-cache: add watchman 'WAMA' extension Nguyễn Thái Ngọc Duy
2015-11-02 22:03 ` David Turner
2015-11-03 19:17 ` Duy Nguyen
2015-11-03 19:49 ` David Turner
2015-11-01 13:55 ` [PATCH 2/5] Add watchman support to reduce index refresh cost Nguyễn Thái Ngọc Duy
2015-11-02 21:19 ` David Turner
2015-11-01 13:55 ` Nguyễn Thái Ngọc Duy [this message]
2015-11-01 13:55 ` [PATCH 4/5] index-helper: use watchman to avoid refreshing index with lstat() Nguyễn Thái Ngọc Duy
2015-11-01 13:55 ` [PATCH 5/5] update-index: enable/disable watchman support Nguyễn Thái Ngọc Duy
2015-11-02 14:54 ` [PATCH 0/5] Use watchman to reduce index refresh time Paolo Ciarrocchi
2015-11-02 19:23 ` Duy Nguyen
2015-11-03 9:21 ` Duy Nguyen
2015-11-03 10:26 ` Paolo Ciarrocchi
2015-11-09 20:06 ` Christian Couder
2015-11-10 21:04 ` David Turner
2015-11-20 9:45 ` Christian Couder
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=1446386146-10438-4-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
/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).