<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Thread.i3:<BR>
<BR>
<BR>
PROCEDURE Join(t: T): REFANY;<BR>(* Wait until "t" has terminated and return its result. It is a<BR> checked runtime error to call this more than once for any "t". *)<BR><BR>
<BR>
ThreadWin32.m3:<BR>
<BR>
<BR>
PROCEDURE Join(t: T): REFANY =<BR> VAR res: REFANY;<BR> BEGIN<BR> LOCK t DO<BR> IF t.joined THEN Die(ThisLine(), "attempt to join with thread twice"); END;<BR> WHILE NOT t.completed DO Wait(t, t.join) END;<BR> res := t.result;<BR> t.result := NIL;<BR> t.joined := TRUE;<BR> t.join := NIL;<BR> END;<BR> RETURN res;<BR> END Join;<BR>
<BR>
PROCEDURE AlertJoin(t: T): REFANY RAISES {Alerted} = similar<BR><BR>
<BR>ThreadPThread.m3:<BR>
<BR>
<BR>PROCEDURE Join (t: T): REFANY =<BR> BEGIN<BR> LOCK t DO<BR> WHILE NOT t.completed DO Wait(t, t.join) END;<BR> END;<BR> RETURN t.result;<BR> END Join;<BR>
<BR>
PROCEDURE AlertJoin (t: T): REFANY RAISES {Alerted} = similar<BR><BR>
<BR>
Should we just loosen the comment and go with the simpler pthread version?<BR>
I'd like Win32 and pthread to be more similar where possible, to ease maintenance.<BR>
<BR>
<BR>
- Jay<BR> </body>
</html>