Add test to see if async I/O has completed before we actually yield the thread. Part of the I/O improvments tagged under bug #3536. Approved wtc.
authorsdagley%netscape.com
Wed, 19 May 1999 02:49:00 +0000
changeset 630 30bd298d3645f11c553a90b3af69c249dd34e908
parent 629 a843303edd27d31f20a8e939e73336e544638f12
child 631 bf9f8bd07d33088a8eb9277dfd6ac8a9c5e5ae2b
push idunknown
push userunknown
push dateunknown
bugs3536
Add test to see if async I/O has completed before we actually yield the thread. Part of the I/O improvments tagged under bug #3536. Approved wtc.
pr/src/md/mac/macio.c
--- a/pr/src/md/mac/macio.c
+++ b/pr/src/md/mac/macio.c
@@ -270,18 +270,20 @@ PRInt32 ReadWriteProc(PRFileDesc *fd, vo
 		*/
 	    me->io_pending = PR_TRUE;
 	    me->io_fd = refNum;
 		me->md.osErrCode = noErr;
 		if (op == READ_ASYNC)
 			(void) PBReadAsync(&pbAsync);
 		else
 			(void) PBWriteAsync(&pbAsync);
-
-		WaitOnThisThread(me, PR_INTERVAL_NO_TIMEOUT);
+		
+		/* 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);
 	}
 	
 	err = me->md.osErrCode;
 	if (err != noErr)
 		goto ErrorExit;
 
 	err = pbAsync.pb.ioParam.ioResult;
 	if (err != noErr && err != eofErr)