From f249808baa3f4f30386185b53bd6ac053a1272e1 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 15 Jul 2019 02:35:56 +0200 Subject: [PATCH] windows-*: Rename glwthread_spinlock_t to glwthread_initguard_t. * lib/windows-initguard.h: Renamed from lib/windows-spinlock.h. (glwthread_initguard_t): Renamed from glwthread_spinlock_t. (GLWTHREAD_INITGUARD_INIT): Renamed from GLWTHREAD_SPINLOCK_INIT. * lib/windows-mutex.h: Update. * lib/windows-recmutex.h: Likewise. * lib/windows-timedmutex.h: Likewise. * lib/windows-timedrecmutex.h: Likewise. * lib/windows-cond.h: Likewise. * lib/glthread/lock.h: Likewise. * modules/windows-mutex (Files): Add lib/windows-initguard.h. Remove lib/windows-spinlock.h. * modules/windows-recmutex (Files): Likewise. * modules/windows-timedmutex (Files): Likewise. * modules/windows-timedrecmutex (Files): Likewise. * modules/windows-cond (Files): Likewise. * modules/threads-h (Files): Likewise. --- ChangeLog | 20 +++++++++++++++++++ lib/glthread/lock.h | 6 +++--- lib/windows-cond.h | 6 +++--- ...windows-spinlock.h => windows-initguard.h} | 12 +++++------ lib/windows-mutex.h | 6 +++--- lib/windows-recmutex.h | 6 +++--- lib/windows-timedmutex.h | 6 +++--- lib/windows-timedrecmutex.h | 6 +++--- modules/threads-h | 2 +- modules/windows-cond | 2 +- modules/windows-mutex | 2 +- modules/windows-recmutex | 2 +- modules/windows-timedmutex | 2 +- modules/windows-timedrecmutex | 2 +- 14 files changed, 50 insertions(+), 30 deletions(-) rename lib/{windows-spinlock.h => windows-initguard.h} (80%) diff --git a/ChangeLog b/ChangeLog index b87f8a533f..ea541d50ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2019-07-14 Bruno Haible + + windows-*: Rename glwthread_spinlock_t to glwthread_initguard_t. + * lib/windows-initguard.h: Renamed from lib/windows-spinlock.h. + (glwthread_initguard_t): Renamed from glwthread_spinlock_t. + (GLWTHREAD_INITGUARD_INIT): Renamed from GLWTHREAD_SPINLOCK_INIT. + * lib/windows-mutex.h: Update. + * lib/windows-recmutex.h: Likewise. + * lib/windows-timedmutex.h: Likewise. + * lib/windows-timedrecmutex.h: Likewise. + * lib/windows-cond.h: Likewise. + * lib/glthread/lock.h: Likewise. + * modules/windows-mutex (Files): Add lib/windows-initguard.h. Remove + lib/windows-spinlock.h. + * modules/windows-recmutex (Files): Likewise. + * modules/windows-timedmutex (Files): Likewise. + * modules/windows-timedrecmutex (Files): Likewise. + * modules/windows-cond (Files): Likewise. + * modules/threads-h (Files): Likewise. + 2019-07-14 Bruno Haible doc: Fix info about pthread API in HP-UX. diff --git a/lib/glthread/lock.h b/lib/glthread/lock.h index bc3a4def38..23d2d98506 100644 --- a/lib/glthread/lock.h +++ b/lib/glthread/lock.h @@ -410,7 +410,7 @@ extern int glthread_once_singlethreaded (pthread_once_t *once_control); # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include -# include "windows-spinlock.h" +# include "windows-initguard.h" # include "windows-mutex.h" # include "windows-recmutex.h" # include "windows-once.h" @@ -464,7 +464,7 @@ typedef struct gl_carray_waitqueue_t; typedef struct { - glwthread_spinlock_t guard; /* protects the initialization */ + glwthread_initguard_t guard; /* protects the initialization */ CRITICAL_SECTION lock; /* protects the remaining fields */ gl_carray_waitqueue_t waiting_readers; /* waiting readers */ gl_carray_waitqueue_t waiting_writers; /* waiting writers */ @@ -476,7 +476,7 @@ typedef struct # define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer; # define gl_rwlock_initializer \ - { GLWTHREAD_SPINLOCK_INIT } + { GLWTHREAD_INITGUARD_INIT } # define glthread_rwlock_init(LOCK) \ (glthread_rwlock_init_func (LOCK), 0) # define glthread_rwlock_rdlock(LOCK) \ diff --git a/lib/windows-cond.h b/lib/windows-cond.h index a21a9d02c3..eb8a613ee5 100644 --- a/lib/windows-cond.h +++ b/lib/windows-cond.h @@ -25,7 +25,7 @@ #include -#include "windows-spinlock.h" +#include "windows-initguard.h" struct glwthread_waitqueue_link { @@ -39,13 +39,13 @@ typedef struct glwthread_linked_waitqueue_t; typedef struct { - glwthread_spinlock_t guard; /* protects the initialization */ + glwthread_initguard_t guard; /* protects the initialization */ CRITICAL_SECTION lock; /* protects the remaining fields */ glwthread_linked_waitqueue_t waiters; /* waiting threads */ } glwthread_cond_t; -#define GLWTHREAD_COND_INIT { GLWTHREAD_SPINLOCK_INIT } +#define GLWTHREAD_COND_INIT { GLWTHREAD_INITGUARD_INIT } #ifdef __cplusplus extern "C" { diff --git a/lib/windows-spinlock.h b/lib/windows-initguard.h similarity index 80% rename from lib/windows-spinlock.h rename to lib/windows-initguard.h index 26a4b6538d..a738c141f1 100644 --- a/lib/windows-spinlock.h +++ b/lib/windows-initguard.h @@ -1,4 +1,4 @@ -/* Spinlocks (native Windows implementation). +/* Init guards, somewhat like spinlocks (native Windows implementation). Copyright (C) 2005-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -17,8 +17,8 @@ /* Written by Bruno Haible , 2005. Based on GCC's gthr-win32.h. */ -#ifndef _WINDOWS_SPINLOCK_H -#define _WINDOWS_SPINLOCK_H +#ifndef _WINDOWS_INITGUARD_H +#define _WINDOWS_INITGUARD_H #define WIN32_LEAN_AND_MEAN /* avoid including junk */ #include @@ -28,8 +28,8 @@ typedef struct volatile int done; volatile LONG started; } - glwthread_spinlock_t; + glwthread_initguard_t; -#define GLWTHREAD_SPINLOCK_INIT { 0, -1 } +#define GLWTHREAD_INITGUARD_INIT { 0, -1 } -#endif /* _WINDOWS_SPINLOCK_H */ +#endif /* _WINDOWS_INITGUARD_H */ diff --git a/lib/windows-mutex.h b/lib/windows-mutex.h index edc738e4c6..67debdfcb6 100644 --- a/lib/windows-mutex.h +++ b/lib/windows-mutex.h @@ -23,16 +23,16 @@ #define WIN32_LEAN_AND_MEAN /* avoid including junk */ #include -#include "windows-spinlock.h" +#include "windows-initguard.h" typedef struct { - glwthread_spinlock_t guard; /* protects the initialization */ + glwthread_initguard_t guard; /* protects the initialization */ CRITICAL_SECTION lock; } glwthread_mutex_t; -#define GLWTHREAD_MUTEX_INIT { GLWTHREAD_SPINLOCK_INIT } +#define GLWTHREAD_MUTEX_INIT { GLWTHREAD_INITGUARD_INIT } #ifdef __cplusplus extern "C" { diff --git a/lib/windows-recmutex.h b/lib/windows-recmutex.h index a4fcb470fa..751933f8f8 100644 --- a/lib/windows-recmutex.h +++ b/lib/windows-recmutex.h @@ -23,7 +23,7 @@ #define WIN32_LEAN_AND_MEAN /* avoid including junk */ #include -#include "windows-spinlock.h" +#include "windows-initguard.h" /* The native Windows documentation says that CRITICAL_SECTION already implements a recursive lock. But we need not rely on it: It's easy to @@ -31,14 +31,14 @@ typedef struct { - glwthread_spinlock_t guard; /* protects the initialization */ + glwthread_initguard_t guard; /* protects the initialization */ DWORD owner; unsigned long depth; CRITICAL_SECTION lock; } glwthread_recmutex_t; -#define GLWTHREAD_RECMUTEX_INIT { GLWTHREAD_SPINLOCK_INIT, 0, 0 } +#define GLWTHREAD_RECMUTEX_INIT { GLWTHREAD_INITGUARD_INIT, 0, 0 } #ifdef __cplusplus extern "C" { diff --git a/lib/windows-timedmutex.h b/lib/windows-timedmutex.h index 268c391f5d..b95227809c 100644 --- a/lib/windows-timedmutex.h +++ b/lib/windows-timedmutex.h @@ -25,17 +25,17 @@ #include -#include "windows-spinlock.h" +#include "windows-initguard.h" typedef struct { - glwthread_spinlock_t guard; /* protects the initialization */ + glwthread_initguard_t guard; /* protects the initialization */ HANDLE event; CRITICAL_SECTION lock; } glwthread_timedmutex_t; -#define GLWTHREAD_TIMEDMUTEX_INIT { GLWTHREAD_SPINLOCK_INIT } +#define GLWTHREAD_TIMEDMUTEX_INIT { GLWTHREAD_INITGUARD_INIT } #ifdef __cplusplus extern "C" { diff --git a/lib/windows-timedrecmutex.h b/lib/windows-timedrecmutex.h index c0d2d3b75a..db64b6f2cf 100644 --- a/lib/windows-timedrecmutex.h +++ b/lib/windows-timedrecmutex.h @@ -25,7 +25,7 @@ #include -#include "windows-spinlock.h" +#include "windows-initguard.h" /* The native Windows documentation says that CRITICAL_SECTION already implements a recursive lock. But we need not rely on it: It's easy to @@ -33,7 +33,7 @@ typedef struct { - glwthread_spinlock_t guard; /* protects the initialization */ + glwthread_initguard_t guard; /* protects the initialization */ DWORD owner; unsigned long depth; HANDLE event; @@ -41,7 +41,7 @@ typedef struct } glwthread_timedrecmutex_t; -#define GLWTHREAD_TIMEDRECMUTEX_INIT { GLWTHREAD_SPINLOCK_INIT, 0, 0 } +#define GLWTHREAD_TIMEDRECMUTEX_INIT { GLWTHREAD_INITGUARD_INIT, 0, 0 } #ifdef __cplusplus extern "C" { diff --git a/modules/threads-h b/modules/threads-h index de9520d711..fafb20b1c0 100644 --- a/modules/threads-h +++ b/modules/threads-h @@ -11,7 +11,7 @@ lib/windows-timedrecmutex.h lib/windows-once.h lib/windows-cond.h lib/windows-tls.h -lib/windows-spinlock.h +lib/windows-initguard.h m4/threads.m4 m4/threadlib.m4 m4/yield.m4 diff --git a/modules/windows-cond b/modules/windows-cond index afb70b0d90..306d7add2c 100644 --- a/modules/windows-cond +++ b/modules/windows-cond @@ -4,7 +4,7 @@ Condition variables (native Windows implementation). Files: lib/windows-cond.h lib/windows-cond.c -lib/windows-spinlock.h +lib/windows-initguard.h Depends-on: stdbool diff --git a/modules/windows-mutex b/modules/windows-mutex index 18aabcc98a..2083ce0812 100644 --- a/modules/windows-mutex +++ b/modules/windows-mutex @@ -4,7 +4,7 @@ Plain mutexes (native Windows implementation). Files: lib/windows-mutex.h lib/windows-mutex.c -lib/windows-spinlock.h +lib/windows-initguard.h Depends-on: diff --git a/modules/windows-recmutex b/modules/windows-recmutex index f8c0861e85..914c40e2ae 100644 --- a/modules/windows-recmutex +++ b/modules/windows-recmutex @@ -4,7 +4,7 @@ Plain recursive mutexes (native Windows implementation). Files: lib/windows-recmutex.h lib/windows-recmutex.c -lib/windows-spinlock.h +lib/windows-initguard.h Depends-on: diff --git a/modules/windows-timedmutex b/modules/windows-timedmutex index a9d053f9f3..b7570643a4 100644 --- a/modules/windows-timedmutex +++ b/modules/windows-timedmutex @@ -4,7 +4,7 @@ Timed mutexes (native Windows implementation). Files: lib/windows-timedmutex.h lib/windows-timedmutex.c -lib/windows-spinlock.h +lib/windows-initguard.h Depends-on: errno diff --git a/modules/windows-timedrecmutex b/modules/windows-timedrecmutex index 116817a981..7d57310f38 100644 --- a/modules/windows-timedrecmutex +++ b/modules/windows-timedrecmutex @@ -4,7 +4,7 @@ Timed recursive mutexes (native Windows implementation). Files: lib/windows-timedrecmutex.h lib/windows-timedrecmutex.c -lib/windows-spinlock.h +lib/windows-initguard.h Depends-on: errno -- 2.39.5