TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: David Etheredge
from: Peter Fitzsimmons
date: 1995-04-17 17:26:34
subject: OS/2 programming tips ???

DE> OK, don't want to sleep ... have too much to do while 
 DE> I am waiting.

DOS ALERT - DOS ALERT - DOS ALERT - DOS ALERT

    (just having fun).

Whenever I see "I have something to do while I'm waiting" it says
that the programmer probably has not grasped the full potential of threads.
This may not apply to you,  but I thought it was a good time to mention it
again.

    Pete's Thread Axiom:  A thread's primary goal should be to do
                          nothing very well.

"Something to do while I'm waiting" can always be replaced by
another thread.  Then you'll have two threads that do nothing when there is
nothing to be done,  instead of 1 thread running in a polling loop.

   > Just want to know immediatly when the
 DE> time has elapsed. I know that I can start another 
 DE> thread and put this one to sleep, but ... I need to 
 DE> respond immediatly to the wakeup call and the child 
 DE> thread must stop while I am processing.

That's what semaphores are for.

 DE> My objective is process control. A certain amount of 
 DE> time error +/- 10 msec is acceptable. The most likely

Since all of the functions I mentioned (DosSleep, DosStartTimer, etc) round
up the period to the next thread interval (which is 32ms),  I think you're
going to have to write a device driver.

How much time between events are we talking about?  


 DE> The main concern here is to drive a specialized serial 
 DE> port which is driving a radio transmitter for a

Using which device driver?  COM.SYS or one that came with the port?  Is
this a digiboard or something?

 DE> telemetry system. Before transmission of the data, the 
 DE> radio must be keyed, a wait for CTS, and then a 
 DE> minimum and  a maximum delay before transmission 
 DE> begins and a maximum key up time. There is also a 
 DE> keyup hold after transmission and several other timers 
 DE> and inputs that must be watched. These times range 
 DE> from 20 msec to 500 msec and may overlap.

I don't know what "keyed", "keyup" etc mean.   Since
I'm ignorant on this,  I can't decide if the standard com.sys would be
appropriate.

Note that the complete source code for COM.SYS is included on the DDK
cdrom;  it might take you a while to familiarize yourself with it, but you
could stick some code in there to to the specialized handshaking that you
need.


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