2012-11-29 Paul Eggert <eggert@cs.ucla.edu>
+ cond, lock, thread: better 'inline'
+ * lib/glthread/cond.c, lib/glthread/cond.h (_GLTHREAD_COND_INLINE):
+ * lib/glthread/thread.c, lib/glthread/thread.h (_GLTHREAD_THREAD_INLINE):
+ New macros. Use them instead of static inline, for header functions.
+ * lib/glthread/cond.c (gl_waitqueue_init, gl_waitqueue_remove)
+ (gl_waitqueue_notify_first, gl_waitqueue_notify_all):
+ * lib/glthread/lock.c (gl_waitqueue_init)
+ (gl_waitqueue_notify_first, gl_waitqueue_notify_all):
+ * lib/glthread/thread.c (get_current_thread_handle):
+ Change 'static inline' to 'inline'.
+ * lib/glthread/cond.h, lib/glthread/thread.h:
+ Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
+ * m4/cond.m4 (gl_COND):
+ * m4/lock.m4 (gl_PREREQ_LOCK):
+ * m4/thread.m4 (gl_THREAD):
+ Do not require AC_C_INLINE.
+ * modules/cond, modules/thread (Depends-on): Add extern-inline.
+
chdir-long, cycle-check, savewd: better 'inline'
* lib/chdir-long.c (cdb_init, cdb_fchdir, cdb_free)
(find_non_slash):
#include <config.h>
+#define _GLTHREAD_COND_INLINE _GL_EXTERN_INLINE
#include "glthread/cond.h"
/* ========================================================================= */
This field is immutable once initialized. */
};
-static inline void
+static void
gl_waitqueue_init (gl_waitqueue_t *wq)
{
wq->wq_list.wql_next = &wq->wq_list;
/* Removes the current thread, represented by a 'struct gl_waitqueue_element *',
from a wait queue.
Returns true if is was found and removed, false if it was not present. */
-static inline bool
+static bool
gl_waitqueue_remove (gl_waitqueue_t *wq, struct gl_waitqueue_element *elt)
{
if (elt->link.wql_next != NULL && elt->link.wql_prev != NULL)
}
/* Notifies the first thread from a wait queue and dequeues it. */
-static inline void
+static void
gl_waitqueue_notify_first (gl_waitqueue_t *wq)
{
if (wq->wq_list.wql_next != &wq->wq_list)
}
/* Notifies all threads from a wait queue and dequeues them all. */
-static inline void
+static void
gl_waitqueue_notify_all (gl_waitqueue_t *wq)
{
struct gl_waitqueue_link *l;
#include "glthread/lock.h"
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GLTHREAD_COND_INLINE
+# define _GLTHREAD_COND_INLINE _GL_INLINE
+#endif
+
/* ========================================================================= */
#if USE_POSIX_THREADS
while (0)
#define gl_cond_timedwait(COND, LOCK, ABSTIME) \
gl_cond_timedwait_func (&COND, &LOCK, ABSTIME)
-static inline bool
+_GLTHREAD_COND_INLINE bool
gl_cond_timedwait_func (gl_cond_t *cond, gl_lock_t *lock, struct timespec *abstime)
{
int err = glthread_cond_timedwait (cond, lock, abstime);
}
#endif
+_GL_INLINE_HEADER_END
+
#endif /* _GLTHREAD_COND_H */
/* In this file, the waitqueues are implemented as circular arrays. */
#define gl_waitqueue_t gl_carray_waitqueue_t
-static inline void
+static void
gl_waitqueue_init (gl_waitqueue_t *wq)
{
wq->array = NULL;
}
/* Notifies the first thread from a wait queue and dequeues it. */
-static inline void
+static void
gl_waitqueue_notify_first (gl_waitqueue_t *wq)
{
SetEvent (wq->array[wq->offset + 0]);
}
/* Notifies all threads from a wait queue and dequeues them all. */
-static inline void
+static void
gl_waitqueue_notify_all (gl_waitqueue_t *wq)
{
unsigned int i;
#include <config.h>
/* Specification. */
+# define _GLTHREAD_THREAD_INLINE _GL_EXTERN_INLINE
#include "glthread/thread.h"
#include <stdlib.h>
};
/* Return a real HANDLE object for the current thread. */
-static inline HANDLE
+static HANDLE
get_current_thread_handle (void)
{
HANDLE this_handle;
#include <errno.h>
#include <stdlib.h>
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GLTHREAD_THREAD_INLINE
+# define _GLTHREAD_THREAD_INLINE _GL_INLINE
+#endif
+
/* ========================================================================= */
#if USE_POSIX_THREADS
extern "C" {
#endif
-static inline gl_thread_t
+_GLTHREAD_THREAD_INLINE gl_thread_t
gl_thread_create (void *(*func) (void *arg), void *arg)
{
gl_thread_t thread;
}
#endif
+_GL_INLINE_HEADER_END
+
#endif /* _GLTHREAD_THREAD_H */
-# cond.m4 serial 1
+# cond.m4 serial 2
dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_DEFUN([gl_COND],
[
AC_REQUIRE([gl_THREADLIB])
- AC_REQUIRE([AC_C_INLINE])
])
-# lock.m4 serial 12 (gettext-0.18.2)
+# lock.m4 serial 13 (gettext-0.18.2)
dnl Copyright (C) 2005-2012 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
gl_PREREQ_LOCK
])
-# Prerequisites of lib/lock.c.
-AC_DEFUN([gl_PREREQ_LOCK], [
- AC_REQUIRE([AC_C_INLINE])
-])
+# Prerequisites of lib/glthread/lock.c.
+AC_DEFUN([gl_PREREQ_LOCK], [:])
-# thread.m4 serial 2
+# thread.m4 serial 3
dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_DEFUN([gl_THREAD],
[
AC_REQUIRE([gl_THREADLIB])
- AC_REQUIRE([AC_C_INLINE])
if test $gl_threads_api = posix; then
gl_save_LIBS="$LIBS"
threadlib
lock
errno
+extern-inline
stdbool
time
gettimeofday
Maintainer:
Yoann Vandoorselaere
-
Depends-on:
threadlib
+extern-inline
lock
configure.ac:
Maintainer:
Yoann Vandoorselaere
-