-/* Copyright (C) 2018-2021 Free Software Foundation, Inc.
+/* Copyright (C) 2018-2024 Free Software Foundation, Inc.
Contributed by Nicolas Koenig
This file is part of the GNU Fortran runtime library (libgfortran).
DEBUG_LINE (__gthread_mutex_t debug_queue_lock = __GTHREAD_MUTEX_INIT;)
DEBUG_LINE (aio_lock_debug *aio_debug_head = NULL;)
+#ifdef __GTHREAD_RWLOCK_INIT
+DEBUG_LINE (aio_rwlock_debug *aio_rwlock_debug_head = NULL;)
+DEBUG_LINE (__gthread_rwlock_t debug_queue_rwlock = __GTHREAD_RWLOCK_INIT;)
+#endif
/* Current unit for asynchronous I/O. Needed for error reporting. */
NOTE ("Changing pdts, current_unit = %p", (void *) (new->u.p.current_unit));
temp = *old;
*old = new;
- if (temp)
- free (temp);
+ free (temp);
}
/* Destroy an adv_cond structure. */
/* Loop over the queue entries until they are finished. */
while (ctq)
{
- if (prev)
- free (prev);
+ free (prev);
prev = ctq;
if (!au->error.has_error)
{
void
enqueue_transfer (async_unit *au, transfer_args *arg, enum aio_do type)
{
- transfer_queue *tq = calloc (sizeof (transfer_queue), 1);
+ transfer_queue *tq = calloc (1, sizeof (transfer_queue));
tq->arg = *arg;
tq->type = type;
tq->has_id = 0;
enqueue_done_id (async_unit *au, enum aio_do type)
{
int ret;
- transfer_queue *tq = calloc (sizeof (transfer_queue), 1);
+ transfer_queue *tq = calloc (1, sizeof (transfer_queue));
tq->type = type;
tq->has_id = 1;
void
enqueue_done (async_unit *au, enum aio_do type)
{
- transfer_queue *tq = calloc (sizeof (transfer_queue), 1);
+ transfer_queue *tq = calloc (1, sizeof (transfer_queue));
tq->type = type;
tq->has_id = 0;
LOCK (&au->lock);
void
enqueue_close (async_unit *au)
{
- transfer_queue *tq = calloc (sizeof (transfer_queue), 1);
+ transfer_queue *tq = calloc (1, sizeof (transfer_queue));
tq->type = AIO_CLOSE;
LOCK (&au->lock);