RABAGLIATIA@isnet.inmos.com (ANDY RABAGLIATI) (01/31/91)
Someone requested the sources of the extraordinary link handling
library. These sources come with all the disclaimers our
medicine man could think of, including the acknowledgement that
they *DEPEND* on knowledge of how the compiler schedules
processes.
If you wish to cut them down to be leaner and meaner, it may
easily be possible. If they fail to work, I refer you again to
our medicine man, who is busy at the moment conjuring up chemical
warfare antidotes from sodom apples.
Cheers, Andy Rabagliati EMAIL:- rabagliatia@isnet.inmos.COM
Here it is:
------------------------------------------------------------------------
--- xlink0.occ --- xlink0.occ --- xlink0.occ ---
#OPTION "E W" -- no compiler libs, full GUYs
#COMMENT "Extraordinary link handling library, V1.0 31/10/88"
#COMMENT "(c) Copyright INMOS Limited 1988"
PROC Reinitialise (CHAN OF ANY c)
SEQ
GUY
LDLP c
RESETCH
MINT
DIFF
CJ .OK
SETERR
:OK
:
--- xlink1.occ --- xlink1.occ --- xlink1.occ ---
#OPTION "E W" -- no compiler libs, full GUYs
#COMMENT "Extraordinary link handling library, V1.0 31/10/88"
#COMMENT "(c) Copyright INMOS Limited 1988"
PROC InputOrFail.t(CHAN OF ANY c, []BYTE mess, TIMER t, VAL INT time,
BOOL aborted)
-- modified to be wordlength-independant 2-dec-87
VAL NotProcess.p IS MOSTNEG INT :
CHAN OF BOOL completed :
--{{{ order of execution is essential
-- The order of execution of the components of this PAR is
-- important. If the communication on c is not started before the
-- ALTernative it is possible for c to be reset before it is used.
-- In this case the process can fail to terminate if the communication
-- on c fails.
--}}}
PAR
--{{{ execute this component first
SEQ
c ? mess
completed ! TRUE
--}}}
--{{{ execute this component second
BOOL sink :
ALT
t ? AFTER time
INT pid :
SEQ
--{{{ reset the channel
GUY
LDLP c
RESETCH
STL pid
--}}}
--{{{ run the process if pid is valid
IF
pid = NotProcess.p
SKIP
TRUE
SEQ
GUY
LDL pid
RUNP
--}}}
completed ? sink
aborted := TRUE
completed ? sink
aborted := FALSE
--}}}
:
--- xlink2.occ --- xlink2.occ --- xlink2.occ ---
#OPTION "E W" -- no compiler libs, full GUYs
#COMMENT "Extraordinary link handling library, V1.0 31/10/88"
#COMMENT "(c) Copyright INMOS Limited 1988"
PROC InputOrFail.c(CHAN OF ANY c, []BYTE mess,CHAN OF INT kill, BOOL aborted)
-- modified to be wordlength independant 2-dec-87
VAL NotProcess.p IS MOSTNEG INT :
CHAN OF BOOL completed :
--{{{ order of execution is essential
-- The order of execution of the components of this PAR is
-- important. If the communication on c is not started before the
-- ALTernative it is possible for c to be reset before it is used.
-- In this case the process can fail to terminate if the communication
-- on c fails.
--}}}
PAR
--{{{ execute this component first
SEQ
c ? mess
completed ! TRUE
--}}}
--{{{ execute this component second
ALT
INT sink :
kill ? sink
INT pid :
SEQ
--{{{ reset the channel
GUY
LDLP c
RESETCH
STL pid
--}}}
--{{{ run the process if pid is valid
IF
pid = NotProcess.p
SKIP
TRUE
SEQ
GUY
LDL pid
RUNP
--}}}
BOOL sink :
completed ? sink
aborted := TRUE
BOOL sink :
completed ? sink
aborted := FALSE
--}}}
:
--- xlink3.occ --- xlink3.occ --- xlink3.occ ---
#OPTION "E W" -- no compiler libs, full GUYs
#COMMENT "Extraordinary link handling library, V1.0 31/10/88"
#COMMENT "(c) Copyright INMOS Limited 1988"
PROC OutputOrFail.t(CHAN OF ANY c, VAL []BYTE mess, TIMER t,
VAL INT time, BOOL aborted)
-- modified to be wordlength independant 2-dec-87
VAL NotProcess.p IS MOSTNEG INT :
CHAN OF BOOL completed :
--{{{ order of execution is essential
-- The order of execution of the components of this PAR is
-- important. If the communication on c is not started before the
-- ALTernative it is possible for c to be reset before it is used.
-- In this case the process can fail to terminate if the communication
-- on c fails.
--}}}
PAR
--{{{ execute this component first
SEQ
c ! mess
completed ! TRUE
--}}}
--{{{ execute this component second
BOOL sink :
ALT
t ? AFTER time
INT pid :
SEQ
--{{{ reset the channel
GUY
LDLP c
RESETCH
STL pid
--}}}
--{{{ run the process if pid is valid
IF
pid = NotProcess.p
SKIP
TRUE
SEQ
GUY
LDL pid
RUNP
--}}}
completed ? sink
aborted := TRUE
completed ? sink
aborted := FALSE
--}}}
:
--- xlink4.occ --- xlink4.occ --- xlink4.occ ---
#OPTION "E W" -- no compiler libs, full GUYs
#COMMENT "Extraordinary link handling library, V1.0 31/10/88"
#COMMENT "(c) Copyright INMOS Limited 1988"
PROC OutputOrFail.c(CHAN OF ANY c, VAL []BYTE mess, CHAN OF INT kill,
BOOL aborted)
-- modified to be wordlength independant 2-dec-87
VAL NotProcess.p IS MOSTNEG INT :
CHAN OF BOOL completed :
--{{{ order of execution is essential
-- The order of execution of the components of this PAR is
-- important. If the communication on c is not started before the
-- ALTernative it is possible for c to be reset before it is used.
-- In this case the process can fail to terminate if the communication
-- on c fails.
--}}}
PAR
--{{{ execute this component first
SEQ
c ! mess
completed ! TRUE
--}}}
--{{{ execute this component second
ALT
INT sink :
kill ? sink
INT pid :
SEQ
--{{{ reset the channel
GUY
LDLP c
RESETCH
STL pid
--}}}
--{{{ run the process if pid is valid
IF
pid = NotProcess.p
SKIP
TRUE
SEQ
GUY
LDL pid
RUNP
--}}}
BOOL sink :
completed ? sink
aborted := TRUE
BOOL sink :
completed ? sink
aborted := FALSE
--}}}
: