properly implement idle call (int 0x2f/0x1680)

Andreas Mohr andi at
Mon Jul 1 16:37:13 CDT 2002

Hi all,

this one implements int 0x2f function 0x1680 (IDLE CALL) properly
by calling a Sleep() with 55ms (i.e. one timer tick).
Calling Linux's sched_yield() to yield to another process turned out
to be impractical (see patch).

This patch makes IDA/DOS a helluva lot more responsive by getting
completely rid of 100% CPU usage.
And most likely heaps of TurboVision (Turbo Pascal/Turbo C++) apps, too...

Andreas Mohr                        Stauferstr. 6, D-71272 Renningen, Germany
-------------- next part --------------
Determining best CVS host...
Using CVSROOT :pserver:cvs at
Index: msdos/int2f.c
RCS file: /home/wine/wine/msdos/int2f.c,v
retrieving revision 1.42
diff -u -r1.42 int2f.c
--- msdos/int2f.c	31 May 2002 23:06:52 -0000	1.42
+++ msdos/int2f.c	1 Jul 2002 21:35:34 -0000
@@ -319,6 +319,18 @@
     case 0x80:  /* Release time-slice */
+	/* Linux sched_yield() still keeps burning CPU cycles
+	 * if the current process is the only one in highest priority list
+	 * (as Linux will immediately return to this process to waste
+	 * more CPU cycles), so sched_yield() is essentially useless for us
+	 * (poor API, if you ask me: its return code should indicate
+	 * whether other processes did run in between, in order for us
+	 * to be able to decide whether to do an additional Sleep() or not...)
+	 * Thus we better unconditionally use a well-balanced Sleep()
+	 * instead to really make sure the process calling int 0x2f/0x1680
+	 * *doesn't* use 100% CPU...
+	 */
+	Sleep(55); /* just wait 55ms (one "timer tick") for now. */
 	AL_reg(context) = 0;

More information about the wine-patches mailing list