| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | TimeSlices ?? |
PF> My question to you is: why are you in a loop waiting
PF> for something to happen? If you were to call one of
PR> Remember, this is a dos program, and to the best of my knoledge Borland
PR> does not simply put a process to sleep and wait for a
PR> keyboard interrupt (as there is only supposed to be
Borland doesn't, but OS/2 does -- if you call a "get key"
function (via DOS (int 21), BIOS (int whatever), or CRT (ie: getch()).
PR> here is basically what I was doing...(I allways welcome better code.)
PR> while( Interested )
PR> { if( kbhit() ) {
PR> TakeApropriateAction()
PR> }else if ( the_window.SizeHit() ) {
PR> TakeDifferentAction()
What does TakeDifferentAction() do? Is it _really_ necessary (ie: if all
it does is display the time or something, this is not required when
running in a VDM or under Windows, since the user can start up plenty of
"Clock" programs).
PR> }
PR> ReleaseTimeSlice(); //added this [ thanks Mike Bilow ]...
PR> }
Although the ReleaseTimeSlice() will make "Pulse" happy, your
program is still in a (perhaps unnecessary) spin loop. If you were to call
a getch()-type function, OS/2 could, if memory gets tight, decide to
swap that whole vdm out if nothing has happened there in a while.
PR> Only way I could think of to call a function that
PR> doesn't return until a keystroke, or mouse message
PR> (under dos) would still have a loop.
ahh; the friggen mouse. I know squat about DOS mouse programming;perhaps
you ARE stuck with a spin loop if you have to check two devices. What you
really need here is two threads, so that they could both be blocked on
their respective devices -- so you're just going to have to port your
program to OS/2 .
PR> BTW, why did you choose WATCOM C++ ? is it in you
PR> opinion supperior to borland? If so, why? I just
PR> bought Borland's C++ for Os/2, but I'm not on a budget
PR> so...
Yes, and IBM Cset++ as well. They are both better (and cheaper) than
Borland in my opinion. People who are acclimatized to Borland's IDE
(unlike me), put up with the bugs and poor support -- but I don't.
Watcom recently changed to $upport -- which has tainted my opinion somewhat.
--- Maximus/2 2.02p1
* Origin: Sol 3/Toronto (905)858-8488 (1:259/414)SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407 SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809 @PATH: 259/414 400 99 250/702 3615/50 396/1 270/101 105/103 42 712/515 @PATH: 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.