From 27dae84ed92f1ef0300263091972338d12e78348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 18 Oct 2025 19:06:52 +0200 Subject: New upstream version 1.4.1 --- tests/windows-timedrwlock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/windows-timedrwlock.c') diff --git a/tests/windows-timedrwlock.c b/tests/windows-timedrwlock.c index e818407c..379b1003 100644 --- a/tests/windows-timedrwlock.c +++ b/tests/windows-timedrwlock.c @@ -1,5 +1,5 @@ /* Timed read-write locks (native Windows implementation). - Copyright (C) 2005-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as -- cgit v1.2.3 From 5f59a34ab747dde8ede7357f3431bf06bd6002fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 8 Mar 2026 17:28:33 +0100 Subject: New upstream version 1.4.2 --- tests/windows-timedrwlock.c | 49 +++++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 31 deletions(-) (limited to 'tests/windows-timedrwlock.c') diff --git a/tests/windows-timedrwlock.c b/tests/windows-timedrwlock.c index 379b1003..2297f637 100644 --- a/tests/windows-timedrwlock.c +++ b/tests/windows-timedrwlock.c @@ -1,5 +1,5 @@ /* Timed read-write locks (native Windows implementation). - Copyright (C) 2005-2025 Free Software Foundation, Inc. + Copyright (C) 2005-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -54,13 +54,10 @@ glwthread_waitqueue_init (glwthread_waitqueue_t *wq) static struct glwthread_waitqueue_element * glwthread_waitqueue_add (glwthread_waitqueue_t *wq) { - struct glwthread_waitqueue_element *elt; - HANDLE event; - /* Allocate the memory for the waitqueue element on the heap, not on the thread's stack. If the thread exits unexpectedly, we prefer to leak some memory rather than to access unavailable memory and crash. */ - elt = + struct glwthread_waitqueue_element *elt = (struct glwthread_waitqueue_element *) malloc (sizeof (struct glwthread_waitqueue_element)); if (elt == NULL) @@ -69,7 +66,7 @@ glwthread_waitqueue_add (glwthread_waitqueue_t *wq) /* Whether the created event is a manual-reset one or an auto-reset one, does not matter, since we will wait on it only once. */ - event = CreateEvent (NULL, TRUE, FALSE, NULL); + HANDLE event = CreateEvent (NULL, TRUE, FALSE, NULL); if (event == INVALID_HANDLE_VALUE) { /* No way to allocate an event. */ @@ -115,12 +112,10 @@ glwthread_waitqueue_notify_first (glwthread_waitqueue_t *wq) { struct glwthread_waitqueue_element *elt = (struct glwthread_waitqueue_element *) wq->wq_list.wql_next; - struct glwthread_waitqueue_link *prev; - struct glwthread_waitqueue_link *next; /* Remove elt from the circular list. */ - prev = &wq->wq_list; /* = elt->link.wql_prev; */ - next = elt->link.wql_next; + struct glwthread_waitqueue_link *prev = &wq->wq_list; /* = elt->link.wql_prev; */ + struct glwthread_waitqueue_link *next = elt->link.wql_next; prev->wql_next = next; next->wql_prev = prev; elt->link.wql_next = NULL; @@ -137,18 +132,14 @@ glwthread_waitqueue_notify_first (glwthread_waitqueue_t *wq) static void glwthread_waitqueue_notify_all (glwthread_waitqueue_t *wq) { - struct glwthread_waitqueue_link *l; - - for (l = wq->wq_list.wql_next; l != &wq->wq_list; ) + for (struct glwthread_waitqueue_link *l = wq->wq_list.wql_next; l != &wq->wq_list; ) { struct glwthread_waitqueue_element *elt = (struct glwthread_waitqueue_element *) l; - struct glwthread_waitqueue_link *prev; - struct glwthread_waitqueue_link *next; /* Remove elt from the circular list. */ - prev = &wq->wq_list; /* = elt->link.wql_prev; */ - next = elt->link.wql_next; + struct glwthread_waitqueue_link *prev = &wq->wq_list; /* = elt->link.wql_prev; */ + struct glwthread_waitqueue_link *next = elt->link.wql_next; prev->wql_next = next; next->wql_prev = prev; elt->link.wql_next = NULL; @@ -209,10 +200,9 @@ glwthread_timedrwlock_rdlock (glwthread_timedrwlock_t *lock) if (elt != NULL) { HANDLE event = elt->event; - DWORD result; LeaveCriticalSection (&lock->lock); /* Wait until another thread signals this event. */ - result = WaitForSingleObject (event, INFINITE); + DWORD result = WaitForSingleObject (event, INFINITE); if (result == WAIT_FAILED || result == WAIT_TIMEOUT) abort (); CloseHandle (event); @@ -269,10 +259,9 @@ glwthread_timedrwlock_wrlock (glwthread_timedrwlock_t *lock) if (elt != NULL) { HANDLE event = elt->event; - DWORD result; LeaveCriticalSection (&lock->lock); /* Wait until another thread signals this event. */ - result = WaitForSingleObject (event, INFINITE); + DWORD result = WaitForSingleObject (event, INFINITE); if (result == WAIT_FAILED || result == WAIT_TIMEOUT) abort (); CloseHandle (event); @@ -402,17 +391,15 @@ glwthread_timedrwlock_timedrdlock (glwthread_timedrwlock_t *lock, if (elt != NULL) { HANDLE event = elt->event; - struct timeval currtime; - DWORD timeout; - DWORD result; - int retval; LeaveCriticalSection (&lock->lock); + struct timeval currtime; gettimeofday (&currtime, NULL); /* Wait until another thread signals this event or until the abstime passes. */ + DWORD timeout; if (currtime.tv_sec > abstime->tv_sec) timeout = 0; else @@ -444,7 +431,7 @@ glwthread_timedrwlock_timedrdlock (glwthread_timedrwlock_t *lock, { /* WaitForSingleObject */ - result = WaitForSingleObject (event, timeout); + DWORD result = WaitForSingleObject (event, timeout); if (result == WAIT_FAILED) abort (); if (result != WAIT_TIMEOUT) @@ -461,6 +448,7 @@ glwthread_timedrwlock_timedrdlock (glwthread_timedrwlock_t *lock, } EnterCriticalSection (&lock->lock); /* Remove ourselves from the waiting_readers. */ + int retval; if (glwthread_waitqueue_remove (&lock->waiting_readers, elt)) retval = ETIMEDOUT; else @@ -522,17 +510,15 @@ glwthread_timedrwlock_timedwrlock (glwthread_timedrwlock_t *lock, if (elt != NULL) { HANDLE event = elt->event; - struct timeval currtime; - DWORD timeout; - DWORD result; - int retval; LeaveCriticalSection (&lock->lock); + struct timeval currtime; gettimeofday (&currtime, NULL); /* Wait until another thread signals this event or until the abstime passes. */ + DWORD timeout; if (currtime.tv_sec > abstime->tv_sec) timeout = 0; else @@ -564,7 +550,7 @@ glwthread_timedrwlock_timedwrlock (glwthread_timedrwlock_t *lock, { /* WaitForSingleObject */ - result = WaitForSingleObject (event, timeout); + DWORD result = WaitForSingleObject (event, timeout); if (result == WAIT_FAILED) abort (); if (result != WAIT_TIMEOUT) @@ -581,6 +567,7 @@ glwthread_timedrwlock_timedwrlock (glwthread_timedrwlock_t *lock, } EnterCriticalSection (&lock->lock); /* Remove ourselves from the waiting_writers. */ + int retval; if (glwthread_waitqueue_remove (&lock->waiting_writers, elt)) retval = ETIMEDOUT; else -- cgit v1.2.3