[Libsysio-commit] HEAD: libsysio/src ioctx.c iowait.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2005-02-25 00:01:19
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7456/src Modified Files: ioctx.c iowait.c Log Message: Cleaned up some duplicated code in the iodone path. As well, there is no a global _sysio_iodone for use by all internal components. Index: ioctx.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/ioctx.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -w -b -B -p -r1.22 -r1.23 --- ioctx.c 25 Jan 2005 00:37:14 -0000 1.22 +++ ioctx.c 25 Feb 2005 00:01:06 -0000 1.23 @@ -44,6 +44,7 @@ #include <stdlib.h> #include <string.h> #include <errno.h> +#include <sched.h> #include <assert.h> #include <sys/uio.h> #include <sys/types.h> @@ -175,6 +176,21 @@ _sysio_ioctx_find(void *id) } /* + * Check if asynchronous IO operation is complete. + */ +int +_sysio_ioctx_done(struct ioctx *ioctx) +{ + + if (ioctx->ioctx_done) + return 1; + if (!(*ioctx->ioctx_ino->i_ops.inop_iodone)(ioctx)) + return 0; + ioctx->ioctx_done = 1; + return 1; +} + +/* * Wait for asynchronous IO operation to complete, return status * and dispose of the context. * @@ -189,9 +205,11 @@ _sysio_ioctx_wait(struct ioctx *ioctx) /* * Wait for async operation to complete. */ - while (!(ioctx->ioctx_done || - (*ioctx->ioctx_ino->i_ops.inop_iodone)(ioctx))) - ; + while (!_sysio_ioctx_done(ioctx)) { +#ifdef POSIX_PRIORITY_SCHEDULING + (void )sched_yield(); +#endif + } /* * Get status. Index: iowait.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/iowait.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -b -B -p -r1.10 -r1.11 --- iowait.c 21 Sep 2004 16:18:31 -0000 1.10 +++ iowait.c 25 Feb 2005 00:01:06 -0000 1.11 @@ -68,10 +68,7 @@ SYSIO_INTERFACE_NAME(iodone)(void *ioid) if (!ioctx) SYSIO_INTERFACE_RETURN(-1, -EINVAL); - rc = - (ioctx->ioctx_done || - (*ioctx->ioctx_ino->i_ops.inop_iodone)(ioctx)); - + rc = _sysio_ioctx_done(ioctx); SYSIO_INTERFACE_RETURN(rc < 0 ? -1 : rc, rc < 0 ? rc : 0); } |