In aio_waitcomplete, do not return EAGAIN if no other threads

have started aio, instead, initialize aio management structure
if it hasn't been done, the reason to adjust this behavior is
to make it a bit friendly for threaded program, consider two
threads, one submits aio_write, and another just calls
aio_waitcomplete to wait any I/O to be completed and recycle the
aio requests, before submitter doing any I/O, the recycler wants
to wait in kernel. This also fixes inconsistency with other aio
syscalls.
This commit is contained in:
David Xu 2005-11-08 23:48:32 +00:00
parent c20cedbfc9
commit 323fe56580
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=152215

View File

@ -2320,7 +2320,7 @@ aio_waitcomplete(struct thread *td, struct aio_waitcomplete_args *uap)
ki = p->p_aioinfo;
if (ki == NULL)
return (EAGAIN);
aio_init_aioinfo(p);
for (;;) {
PROC_LOCK(p);