about summary refs log tree commit diff
path: root/rt/aio_error.c
diff options
context:
space:
mode:
Diffstat (limited to 'rt/aio_error.c')
-rw-r--r--rt/aio_error.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/rt/aio_error.c b/rt/aio_error.c
index 730b64b5e9..ed664ae0ef 100644
--- a/rt/aio_error.c
+++ b/rt/aio_error.c
@@ -28,11 +28,21 @@
 /* And undo the hack.  */
 #undef aio_error64
 
+#include <aio_misc.h>
+
 
 int
 aio_error (const struct aiocb *aiocbp)
 {
-  return aiocbp->__error_code;
+  int ret;
+
+  /* Acquire the mutex to make sure all operations for this request are
+     complete.  */
+  pthread_mutex_lock(&__aio_requests_mutex);
+  ret = aiocbp->__error_code;
+  pthread_mutex_unlock(&__aio_requests_mutex);
+
+  return ret;
 }
 
 weak_alias (aio_error, aio_error64)