/* Implement a trivial subset of POSIX 1003.1-2008 pthread.h.
- Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2009-2011 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/* Written by Paul Eggert and Glen Lenker. */
-#ifndef _GL_PTHREAD_H_
+#ifndef _@GUARD_PREFIX@_PTHREAD_H_
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
# @INCLUDE_NEXT@ @NEXT_PTHREAD_H@
#endif
-#ifndef _GL_PTHREAD_H_
-#define _GL_PTHREAD_H_
+#ifndef _@GUARD_PREFIX@_PTHREAD_H_
+#define _@GUARD_PREFIX@_PTHREAD_H_
#include <errno.h>
#include <stdlib.h>
#include <time.h>
#if ! @HAVE_PTHREAD_T@
+# if !GNULIB_defined_pthread_types
typedef int pthread_t;
typedef int pthread_attr_t;
typedef int pthread_barrier_t;
typedef int pthread_once_t;
typedef int pthread_rwlock_t;
typedef int pthread_rwlockattr_t;
+# define GNULIB_defined_pthread_types 1
+# endif
#endif
#ifndef PTHREAD_COND_INITIALIZER
#if ! @HAVE_PTHREAD_T@
+# if !GNULIB_defined_pthread_functions
+
/* Provide substitutes for the thread functions that should work
adequately on a single-threaded implementation, where
pthread_create always fails. The goal is to let programs compile
return 0;
}
+# define GNULIB_defined_pthread_functions 1
+# endif
+
#endif
#if ! @HAVE_PTHREAD_SPINLOCK_T@
+# if !GNULIB_defined_pthread_spinlock_t
+
/* Approximate spinlocks with mutexes. */
typedef pthread_mutex_t pthread_spinlock_t;
{
return pthread_mutex_unlock (lock);
}
+
+# define GNULIB_defined_pthread_spinlock_t 1
+# endif
+
#endif
-#endif /* _GL_PTHREAD_H_ */
-#endif /* _GL_PTHREAD_H_ */
+#endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
+#endif /* _@GUARD_PREFIX@_PTHREAD_H_ */