Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!utgpu!water!watmath!dalcs!dalcsug!dalegass
From: dalegass@dalcsug.UUCP
Newsgroups: comp.sys.ibm.pc
Subject: Re: BACKGROUND PROCESSES UNDERS DOS
Message-ID: <111@dalcsug.UUCP>
Date: Mon, 13-Jul-87 16:21:40 EDT
Article-I.D.: dalcsug.111
Posted: Mon Jul 13 16:21:40 1987
Date-Received: Tue, 14-Jul-87 04:56:46 EDT
References: <176@titn.TITN>
Reply-To: dalegass@dalcsug.UUCP (Dale Gass)
Organization: Dalhousie University, Halifax, N.S., Canada
Lines: 45

>Hello - we have a background process under DOS, which:
>
>	1)	Terminates And Stays Resident
>	2)	Chains Off The Timer Interrupt To Run
>	3)	Reads Info From A Modem Line And Writes It To Disk
>
>We are having problems with 3) -- sometimes it works, sometimes it crashes.
>We have tried looking at the DOS busy flag and appear to do the right thing,
>but it still fails intermittantly.
>
>Has anyone out there experienced this problem, and possibly know of a
>solution???
>
>Thanks in advance:
>
>			Jordan
>
>-- 
>=============================================================================
>Jordan Bortz	Higher Level Software 1085 Warfield Ave  Piedmont, CA   94611
>(415) 268-8948	UUCP:	(decvax|ucbvax|ihnp4)!decwrl!sun!dlb!plx!titn!jordan
>=============================================================================

I'm working on a very similar set of routines, that work off the timer
and RS232 routines.  I've got the following working:

  wait(x) - returns control to the foreground for the specified time
  dos()   - invokes DOS, possibly waiting for it to become free--
	    returning control to the foreground while waiting
  com_out()-sends a character to RS232, returns control to the foreground
	    until finished being sent

  com_in() - returns a character from the RS232 buffer if there's
	     any there, or returns to the foreground until one is received.  
	     This is written but not debugged completely yet.  Stack
	     problems are giving me hassles, but I expect to have these
	     fixed in about a week.


One thing you may have missed when writing to files is the fact that file
pointers may not be preserved between background time slices.  I.E. You
should open a file, write to it, and close it, without giving any time
to the foreground process, or else you may lose your handle.

- dalegass@dalcsug.uucp