Article View: comp.sys.transputer
Article #2666Re: Parallel output on TDS2 for the PC
From: Ian Gorton
Date: Mon, 01 May 1989 01:38
Date: Mon, 01 May 1989 01:38
52 lines
2552 bytes
2552 bytes
In article <1989Apr27.120625.5348@csuchico.uucp>, tempest@csuchico.uucp (Kenneth Lui) writes:
> I'm just getting the feel of Occam 2 on TDS2. I"ve written some simple
> SEQtype programs and some ALTtype programs. I'm having some problems
> with PAR structures. Specifically, I want to write a section of code that
[deleted]
> I used the following code fragment:
> ...
> PAR
> SEQ
> write.full.string(screen,"String from 'a'")
> newline(screen)
> SEQ
> write.full.string(screen,"String from 'b'")
> newline(screen)
> ...
>
> Needless to say, it doesn't work. All I got was a big blank from the VDT,
> except one carriagereturn or linefeed. I looked through the example
Yeah, the reason is that you're breaking one of the fundamental laws of
occam channels. You are attempting to write to the screen channel
from TWO processes simultaneously. This is not allowed, as each channel
may only have one process outputting to it, and one inputting from it.
A library routine is your solution, it's documented in the
PROGRAMMING INTERFACE section of the TDS manuals. The library process you
need is called 'scrstream.multiplexor': it essentially multiplexes output
from a number of channels onto the 'real' screen channel. This sort of
process is frequently required in occam programs.
So, to solve your problem you need,
[2]CHAN OF ANY scr:
CHAN OF INT stop: -- to terminate multiplexor
PAR
scrstream.multiplexor(scr, screen, stop)
SEQ
PAR
SEQ
write.full.string(scr[0], " whatever")
newline(scr[0])
SEQ
write.full.string(scr[1], "something else")
newline(scr[0])
stop ! 22 -- send any value to terminate multiplexor
The added complications come about because it's necessary to terminate
the multiplexor process, and the signal to do this ( stop ! 22 ) must
be sent after EVERYTHING has been sent to the screen.
It should work! Don't forget to include the libraries.
Good luck, Ian Gorton
Technical Details
Message-ID:
<737@uowcsa.cs.uow.oz>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!cs.utexas.edu!uunet!munnari!otc!metro!basser!wolfen!uowcsa!ianReferences:
<1989Apr27.120625.5348@csuchico.uucp>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!cs.utexas.edu!uunet!munnari!otc!metro!basser!wolfen!uowcsa!ian From: ian@uowcsa.cs.uow.oz (Ian Gorton) Newsgroups: comp.sys.transputer Subject: Re: Parallel output on TDS2 for the PC Summary: A solution Keywords: Occam Message-ID: <737@uowcsa.cs.uow.oz> Date: 1 May 89 01:38:44 GMT References: <1989Apr27.120625.5348@csuchico.uucp> Organization: Uni of Wollongong, NSW, Australia Lines: 52