summaryrefslogtreecommitdiff
path: root/sysdeps/pthread/aio_misc.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2016-05-04 15:14:29 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-05-04 15:14:29 +0200
commitfd67a9cf7b733da082e4b6a5f25c19ea7921b4cd (patch)
treed3b9b15daa78a73e36a4624021585f916f8646d5 /sysdeps/pthread/aio_misc.c
parent066746783d6c6c0f61b39c741177e24a9b398a20 (diff)
downloadglibc-fd67a9cf7b733da082e4b6a5f25c19ea7921b4cd.tar.gz
aio: fix newp->running data race
* sysdeps/pthread/aio_misc.c (__aio_enqueue_request): Do not write `running` field of `newp` when a thread was started to process it, since that thread will not take `__aio_requests_mutex`, and the field already has the proper value actually.
Diffstat (limited to 'sysdeps/pthread/aio_misc.c')
-rw-r--r--sysdeps/pthread/aio_misc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sysdeps/pthread/aio_misc.c b/sysdeps/pthread/aio_misc.c
index f55570d23b..faf139d901 100644
--- a/sysdeps/pthread/aio_misc.c
+++ b/sysdeps/pthread/aio_misc.c
@@ -453,7 +453,11 @@ __aio_enqueue_request (aiocb_union *aiocbp, int operation)
result = 0;
}
}
+ else
+ newp->running = running;
}
+ else
+ newp->running = running;
/* Enqueue the request in the run queue if it is not yet running. */
if (running == yes && result == 0)
@@ -466,9 +470,7 @@ __aio_enqueue_request (aiocb_union *aiocbp, int operation)
pthread_cond_signal (&__aio_new_request_notification);
}
- if (result == 0)
- newp->running = running;
- else
+ if (result != 0)
{
/* Something went wrong. */
__aio_free_request (newp);