From: Jonathan Nieder <jrnieder@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Subject: [PATCH 1/2] simplify inclusion of pthread.h
Date: Fri, 10 Dec 2010 13:47:54 -0600 [thread overview]
Message-ID: <20101210194754.GB6801@burratino> (raw)
In-Reply-To: <20101210194637.GA6801@burratino>
In v1.7.1.1~56^2 (Thread-safe xmalloc and xrealloc needs a recursive
mutex, 2010-04-08), the thread-utils header started using
pthread_mutex_t, so callers, which generally had been using
#ifndef NO_PTHREADS
#include "thread-utils.h"
#include <pthread.h>
#endif
before, were changed to include <pthread.h> first. It is simpler to
let thread-utils.h take care of the whole matter. This way, we can
later add more things that the threaded part of the system would need
to thread-utils.h inside "ifndef NO_PTHREADS" and they will
automatically get included by all headers.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
builtin/grep.c | 4 ----
builtin/pack-objects.c | 4 ----
thread-utils.h | 4 ++++
transport-helper.c | 4 ----
4 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/builtin/grep.c b/builtin/grep.c
index adb5424..fdf7131 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -17,11 +17,7 @@
#include "grep.h"
#include "quote.h"
#include "dir.h"
-
-#ifndef NO_PTHREADS
-#include <pthread.h>
#include "thread-utils.h"
-#endif
static char const * const grep_usage[] = {
"git grep [options] [-e] <pattern> [<rev>...] [[--] <path>...]",
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index f027b3a..b0503b2 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -16,11 +16,7 @@
#include "list-objects.h"
#include "progress.h"
#include "refs.h"
-
-#ifndef NO_PTHREADS
-#include <pthread.h>
#include "thread-utils.h"
-#endif
static const char pack_usage[] =
"git pack-objects [ -q | --progress | --all-progress ]\n"
diff --git a/thread-utils.h b/thread-utils.h
index 1727a03..6fb98c3 100644
--- a/thread-utils.h
+++ b/thread-utils.h
@@ -1,7 +1,11 @@
#ifndef THREAD_COMPAT_H
#define THREAD_COMPAT_H
+#ifndef NO_PTHREADS
+#include <pthread.h>
+
extern int online_cpus(void);
extern int init_recursive_mutex(pthread_mutex_t*);
+#endif
#endif /* THREAD_COMPAT_H */
diff --git a/transport-helper.c b/transport-helper.c
index 3a50856..4e4754c 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -8,11 +8,7 @@
#include "quote.h"
#include "remote.h"
#include "string-list.h"
-
-#ifndef NO_PTHREADS
-#include <pthread.h>
#include "thread-utils.h"
-#endif
static int debug;
--
1.7.2.4
next prev parent reply other threads:[~2010-12-10 19:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-10 11:48 [PATCH] transport-helper: avoid dependency on thread-utils.h Jonathan Nieder
2010-12-10 18:21 ` Junio C Hamano
2010-12-10 19:46 ` [PATCH 0/2] " Jonathan Nieder
2010-12-10 19:47 ` Jonathan Nieder [this message]
2010-12-10 19:51 ` [PATCH 1/2] simplify inclusion of pthread.h Jonathan Nieder
2010-12-10 19:48 ` [PATCH 2/2] Makefile: transport-helper uses thread-utils.h Jonathan Nieder
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=20101210194754.GB6801@burratino \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ilari.liusvaara@elisanet.fi \
/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