summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsdagley%netscape.com <devnull@localhost>1999-10-15 23:35:27 +0000
committersdagley%netscape.com <devnull@localhost>1999-10-15 23:35:27 +0000
commitb5aebc2d5615b5719a2d5239e4d23eaada07e2e2 (patch)
tree2999381abeae02a829a6956e10689d15235fee11
parenta5766204f3d26c1596855aa51a502ab6ed5a978e (diff)
downloadnspr-hg-b5aebc2d5615b5719a2d5239e4d23eaada07e2e2.tar.gz
Fix #15740 - now check for immediate errors from async i/o calls. Also ensure that io_pending flag for the thread is cleared if we complete the async call before calling WaitOnThisThread(). r=sfraser
-rw-r--r--pr/src/md/mac/macio.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/pr/src/md/mac/macio.c b/pr/src/md/mac/macio.c
index 2c2d778f..df9e905f 100644
--- a/pr/src/md/mac/macio.c
+++ b/pr/src/md/mac/macio.c
@@ -264,8 +264,11 @@ PRInt32 ReadWriteProc(PRFileDesc *fd, void *buf, PRUint32 bytes, IOOperation op)
*/
if ( bytes > 20480L )
{
- me->io_pending = PR_TRUE; /* Only mark thread io pending in async call */
- (void) PBReadAsync(&pbAsync.pb);
+ err = PBReadAsync(&pbAsync.pb);
+ if (err != noErr && err != eofErr)
+ goto ErrorExit;
+
+ me->io_pending = PR_TRUE; /* Only mark thread io pending if async call worked */
}
else
{
@@ -280,14 +283,20 @@ PRInt32 ReadWriteProc(PRFileDesc *fd, void *buf, PRUint32 bytes, IOOperation op)
}
else
{
- /* writes are currently always async so mark thread io pending */
+ /* writes are currently always async */
+ err = PBWriteAsync(&pbAsync.pb);
+ if (err != noErr)
+ goto ErrorExit;
+
+ /* Didn't get an error on the asyn call so mark thread io pending */
me->io_pending = PR_TRUE;
- (void) PBWriteAsync(&pbAsync.pb);
}
/* See if the i/o call is still pending before we actually yield */
if (pbAsync.pb.ioParam.ioResult == 1)
WaitOnThisThread(me, PR_INTERVAL_NO_TIMEOUT);
+ else
+ me->io_pending = PR_FALSE; /* io completed so don't mark thread io pending */
}
err = me->md.osErrCode;