home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / os2 / programm / 7336 < prev    next >
Encoding:
Internet Message Format  |  1993-01-06  |  1.3 KB

  1. Path: sparky!uunet!gossip.pyramid.com!olivea!sgigate!sgiblab!spies!wicat!kevin
  2. From: kevin@wicat.com (Kevin Vigor)
  3. Newsgroups: comp.os.os2.programmer
  4. Subject: Re: Surrendering timeslice under DOS?
  5. Message-ID: <1993Jan5.231303.14795@wicat.com>
  6. Date: 5 Jan 93 23:13:03 GMT
  7. References: <93003.035144U16244@uicvm.uic.edu>
  8. Reply-To: kevin@elvis.wicat.com
  9. Organization: WICAT Systems
  10. Lines: 35
  11.  
  12. David James Alexander Hanley <U16244@uicvm.uic.edu> writes:
  13.  
  14. >(global) int under_os2 = test_under_os2();
  15.  
  16. >{
  17. >..
  18. >..
  19. >  while ( !kbhit() && !mouse_pressed() )
  20. >    if ( under_os2 ) surrender_timeslice();
  21. >}
  22.  
  23. >  Okay, that's not the most efficent way, but you see that I mean.  It
  24. >drives me nuts to have a dos program that needs 3% of the CPU consuming
  25. >100% of it.
  26.  
  27.  
  28. <who maintains the FAQ for this group? This should probably be included...>
  29.  
  30. Anyway, there is some debate as to how best to determine if you're running
  31. in an OS/2 DOS box. Myself, I prefer to check the DOS version; if the major
  32. version is 20 or above, you're under OS/2 2.x.
  33.  
  34. Once you know you're in an OS/2 DOS box, calling interrupt 2F with AX set to
  35. 01680h will release the timeslice.
  36.  
  37. I have no idea if it works in OS/2 versions previous to 2.0; I do know it
  38. works under Windows 3.x.
  39.  
  40. dd
  41.  
  42. -- 
  43.         Peace & PopTarts, 
  44.             Kevin
  45. Email to the reply address will almost certainly bounce; use
  46. 72500.3705@compuserve.com
  47.