TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Jonathan de Boyne Pollard
from: Peter Fitzsimmons
date: 1995-05-17 04:28:20
subject: WaitForMessage();

JdBP>   Secondary thread 3 :

 JdBP>  	for (;;) {
 JdBP>  	    DosSleep(1000) ;
 JdBP>  	    update_clock_display () ;
 JdBP>  	}

 JdBP>   ( Incidentally, Peter Fitzsimmons will tell you
 JdBP> that you can also page
 JdBP>     tune the program by putting the inner loops of the threads as close
 JdBP>     together as possible, reducing the working set
 JdBP> of an idle process. )

Actually,  before I started pointing that out,  i'd COMPLAIN about the
existence of "thread 3" -- there's no need for any application --
unless it is THE clock application -- to display a clock.  This stupid
& unnecessary feature will prevent the program from being swapped out
(or will create swapping activity every second on an overcommitted
system),when the program really doesn't have anything useful to do.

Pete's new application rule #1:  An application should only use CPU
        	       	 cycles as a direct result of activity
        	       	 from a device (keyb, mouse, modem,  for
        	       	 example).

Exception to rule #1:  Scheduled events (For example,  a backup
        	       program).  Before the event,  the program is
        	       blocked.


You are breaking rule #1 if:  You are asking (polling) a device to
        	             see if anything has happened since the
        	             last time you polled it.

You are breaking rule #1 if:  You have to place a DosSleep() in your
        	             program to prevent "Pulse" from staying
        	             anywhere near 100%.


If you (not Jon de BP:-) are reading this,  and can't figure out a way to
abide by this rule,  tell us what you are doing and we'll fix it for you!


--- 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™.