TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Peter Fitzsimmons
from: David Muir
date: 1996-02-16 15:01:52
subject: Re: async timer thread

-=> Quoting Peter Fitzsimmons to David Muir <=-

 PF> Can you explain the relationship of the other threads to this timer
 PF> thread?  I'm not sure I understand what you are up to. 

    The "general idea" goes something like this. I want to
"do something" for 
60 seconds. While i'm doing that I want to count backwards on screen for each 
new second.
    The "original" method was to use the gettime and compare the
seconds count 
(accurate but inefficient). I was hoping to replace this thread with an 
equally accurate thread that was blocked by a semaphore (rather than 
dossleep). as more and more threads and functions are used, the probability of 
failing to return from a dossleep in time to catch the change increases, thus 
leaving me with an unstable timer, or one which doesn't display
"every" second 
(depending on how it's implemented). By using a semaphore blocked thread this 
thread will be awaked "as needed" and will increase the odds of accurate 
results (although not guarantee them if I understand the CPU usage correctly), 
so basically right now I'm doing this...

repeat
   if seconds>0 then begin
      DosQuerySysInfo(QSV_MS_COUNT,QSV_MS_COUNT, ms, sizeof(ms));
      ms:=ms div 1000;
      if mslasttime then begin
         dec(seconds);
         lasttime:=ms;
         end;
      end;
   dossleep(500);
   until false;
end;

    Where seconds is set externally and this thread then begins to count them 
down (some "actions" excluded from this thread which involve what
to do as the 
seconds are counted down).

    What I "want" to do is the same basic concept without needing
to dossleep 
(using semaphores).
    If this can't be done aside from using the 16bit timer functions, then 
could you supply me with the API entry numbers of those functions so I can 
import them into my program?

Does any of this make any sense? (can a thread be blocked by a semaphore?).

Dave...

~~~ TGWave v1.12+
--- GEcho 1.11+
* Origin: fks Online! * Ontario, Canada * (905)820-7273 * (1:259/423)
SEEN-BY: 50/99 78/0 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809
@PATH: 259/423 400 99 250/99 3615/50 396/1 270/101 712/515 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™.