thread-utils.h: simplify the inclusion

All files that include this header file use the same four line
incantation:

    #ifndef NO_PTHREADS
    #include <pthread.h>
    #include "thread-utils.h"
    #endif

Move the responsibility for that gymnastics to the header file from the
files that include it.  This approach makes it easier to later declare new
services that are related to threading in thread-utils.h and have them
available to all the threading code.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano 2010-12-10 10:32:12 -08:00
parent e4117b1fe8
commit b361888dd5
4 changed files with 4 additions and 12 deletions

View File

@ -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>...]",

View File

@ -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"

View File

@ -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 */

View File

@ -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;