Newsgroups: comp.sys.transputer
From: Gene Clendon <clendon@bnr.ca>
Subject: Please help with Occam/tranputers
Organization: My own
Date: Thu, 17 Mar 1994 07:31:11 GMT
Message-ID: <1994Mar17.073111.7166@bnr.ca>

Hi there!
I'm having a few problems coming to grips with Occam at the moment.  Can
anyone help me on this?

When communicating on channels, the process will hold until that
communication is complete.  If the receiver is expecting more than what
is sent, it will deadlock.
One way to avoid the receiving problem is to place a timer into an ALT
with the receive, so that if no communication reaches the channel after a
set time, the 'ALT times out' so to speak and carries on with the job at
hand.  Now this is all very well and good, but what happens if
communication begins on that channel but for some reason breaks down half
way through?  The ALT is dedicated already to the comms so cannot break
out.  Also, is there an equivalent thing for timing out on a
'no-transmit'?

I know the library contains the Extraordinary link handling functions,
but I'm having troubles with using them - the very least being that CHAN
OF ANY is obsolete, so RETYPING a channel to CHAN OF ANY to use in one of
the functions reports a warning (obviously still compiles though...)
My problem is that even if I define my channel as ANY right to begin with
(at both ends) and transmit a BYTE buffer, I only get timeouts when I
call the procedure.  What should I be doing?
Also, would some kind sole please tell me a bit about RETYPING. I'm not
too clued up on it. 
This is breifly what I'm trying to do...

[4]CHAN OF INT linkout:
timer clock, etc
...
        VAL INT timeout IS 100000/64:   (<-long timeout!)
         [100]INT buffer:
         INT time:
         INT timenow:
	       [4]BOOL aborted:
	           SEQ
		             clock ? time
		              VAL []BYTE buffer2 RETYPES buffer:
		              [4]CHAN OF ANY out RETYPES linkout: 
	                PAR
                      OutputOrFail.t (out[1], buffer2, clock,
time+timeout, aborted[1])
 ...
etc 
please excuse the lack of formatting.  I know there is something
receiving - if I replace the procedure with a simple linkout[1]!buffer,
then its ok.
AHHH! what am I doing wrong?  Have I mis-understood the retyping?

Thanks in advance for your time

Gene Clendon
clendon@bnr.ca
My opinions are my own

