[comp.sys.amiga.tech] Setting priority for 2 interacting programs

BAXTER_A@wehi.dn.mu.oz (11/26/90)

PROBLEM:

Program A spools a file to disk and execute()s a command to type
the file to a device which prints it after some processing.

Program A runs at priority 0, device runs at priority 5.

Device hoggs processor, and Program A does bugger all, making the
spool fairly useless.

Thus Program A at priority 0, device at priority 0.

Works fine, except now, if Program A tries to write direct to device
with fprintf() calls, the system hangs (or seems to, I got bored).

This does _not_ happen if device priority is set to 5.

Note, I do not check the return code from fprintf(). Should I? What's
wrong with this? How do I get the two programs to talk to each other
politely without stepping on each others toes?

Regards Alan

BAXTER_A@wehi.dn.mu.oz (11/27/90)

In article <16666@wehi.dn.mu.oz>, BAXTER_A@wehi.dn.mu.oz writes:
> PROBLEM:
> 
> Program A spools a file to disk and execute()s a command to type
> the file to a device which prints it after some processing.
> 
> Program A runs at priority 0, device runs at priority 5.
> 
> Device hoggs processor, and Program A does bugger all, making the
> spool fairly useless.
> 
> Thus Program A at priority 0, device at priority 0.
> 
> Works fine, except now, if Program A tries to write direct to device
> with fprintf() calls, the system hangs (or seems to, I got bored).
> 
> This does _not_ happen if device priority is set to 5.
> 
> Note, I do not check the return code from fprintf(). Should I? What's
> wrong with this? How do I get the two programs to talk to each other
> politely without stepping on each others toes?
> 

Further to this, the actual command that hangs is:                                                                
                                                                                    
   if (!(fp = fopen(plotname,"w") )) { Message("ERROR: Can't write to
file:",plotname); return(FALSE);}

Where plotname is a string which contains the name of the device.

It appears that fopen() has trouble opening a device with a low priority
but does not actually fail.

Any ideas?

Regards Alan