2012-11-29 Paul Eggert <eggert@cs.ucla.edu>
+ pthread: better 'inline'
+ * lib/pthread.c: New file.
+ * lib/pthread.in.h (_GL_PTHREAD_INLINE):
+ New macro. Replace all uses of 'static inline' with it.
+ Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
+ * m4/pthread.m4 (gl_PTHREAD_CHECK):
+ Add AC_LIBOBJ([pthread]). Do not require AC_C_INLINE.
+ * modules/pthread (Files): Add lib/pthread.c.
+ (Depends-on): Add extern-inline.
+
math: better 'inline'
* lib/math.c: New file.
* lib/math.in.h (_GL_MATH_INLINE):
#include <sys/types.h>
#include <time.h>
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_PTHREAD_INLINE
+# define _GL_PTHREAD_INLINE _GL_INLINE
+#endif
+
#if ! @HAVE_PTHREAD_T@
# if !GNULIB_defined_pthread_types
typedef int pthread_t;
know what to do, so that they elicit a compile-time error for
now. */
-static inline int
+_GL_PTHREAD_INLINE int
pthread_cond_destroy (pthread_cond_t *cond)
{
/* COND is never seriously used. */
return 0;
}
-static inline int
+_GL_PTHREAD_INLINE int
pthread_cond_init (pthread_cond_t *restrict cond,
pthread_condattr_t const *restrict attr)
{
return 0;
}
-static inline int
+_GL_PTHREAD_INLINE int
pthread_cond_signal (pthread_cond_t *cond)
{
/* No threads can currently be blocked on COND. */
return 0;
}
-static inline int
+_GL_PTHREAD_INLINE int
pthread_cond_wait (pthread_cond_t *restrict cond,
pthread_mutex_t *restrict mutex)
{
return 0;
}
-static inline int
+_GL_PTHREAD_INLINE int
pthread_create (pthread_t *restrict thread,
pthread_attr_t const *restrict attr,
void * (*start_routine) (void*), void *restrict arg)
return EAGAIN;
}
-static inline void
+_GL_PTHREAD_INLINE void
pthread_exit (void *value)
{
/* There is just one thread, so the process exits. */
exit (0);
}
-static inline int
+_GL_PTHREAD_INLINE int
pthread_join (pthread_t thread, void **pvalue)
{
/* Properly-written applications never come here. */
return 0;
}
-static inline int
+_GL_PTHREAD_INLINE int
pthread_mutexattr_destroy (pthread_mutexattr_t *attr)
{
return 0;
}
-static inline int
+_GL_PTHREAD_INLINE int
pthread_mutexattr_init (pthread_mutexattr_t *attr)
{
return 0;
}
-static inline int
+_GL_PTHREAD_INLINE int
pthread_mutexattr_settype (pthread_mutexattr_t *attr, int attr_type)
{
return 0;
}
-static inline int
+_GL_PTHREAD_INLINE int
pthread_mutex_destroy (pthread_mutex_t *mutex)
{
/* MUTEX is never seriously used. */
return 0;
}
-static inline int
+_GL_PTHREAD_INLINE int
pthread_mutex_init (pthread_mutex_t *restrict mutex,
pthread_mutexattr_t const *restrict attr)
{
return 0;
}
-static inline int
+_GL_PTHREAD_INLINE int
pthread_mutex_lock (pthread_mutex_t *mutex)
{
/* There is only one thread, so it always gets the lock. This
return 0;
}
-static inline int
+_GL_PTHREAD_INLINE int
pthread_mutex_trylock (pthread_mutex_t *mutex)
{
return pthread_mutex_lock (mutex);
}
-static inline int
+_GL_PTHREAD_INLINE int
pthread_mutex_unlock (pthread_mutex_t *mutex)
{
/* There is only one thread, so it always unlocks successfully.
typedef pthread_mutex_t pthread_spinlock_t;
-static inline int
+_GL_PTHREAD_INLINE int
pthread_spin_init (pthread_spinlock_t *lock, int pshared)
{
return pthread_mutex_init (lock, NULL);
}
-static inline int
+_GL_PTHREAD_INLINE int
pthread_spin_destroy (pthread_spinlock_t *lock)
{
return pthread_mutex_destroy (lock);
}
-static inline int
+_GL_PTHREAD_INLINE int
pthread_spin_lock (pthread_spinlock_t *lock)
{
return pthread_mutex_lock (lock);
}
-static inline int
+_GL_PTHREAD_INLINE int
pthread_spin_trylock (pthread_spinlock_t *lock)
{
return pthread_mutex_trylock (lock);
}
-static inline int
+_GL_PTHREAD_INLINE int
pthread_spin_unlock (pthread_spinlock_t *lock)
{
return pthread_mutex_unlock (lock);
#endif
+_GL_INLINE_HEADER_END
+
#endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
#endif /* _@GUARD_PREFIX@_PTHREAD_H_ */