<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
> (Whether the implementation actually prohibits it or not is an implementation decision.) <BR>
<BR>Tony, I'm sympathetic to the smaller version but I think it is wrong.<BR>
"It is a checked runtime error to call this more than once for any t"<BR>
is a much different/stronger statement than e.g.<BR>
"it is implementation defined what happens if you call join more than once for any t".<BR>
The printed Reactor 4.1 docs have the same comment as current Thread.i3.<BR>
<BR>
You know, ideally if I write:<BR>
Thread.Join(t);<BR>Thread.Join(t);<BR>
<BR>and it works today on any system, it will continue to work on all systems.<BR>I think "implementation defined" is something Modula-3 tries to have less of.<BR>
<BR>
On the other hand, I think if we foresee it to work trivially on all<BR>
forseeable implementations, we can change the interface by removing the comment.<BR>
Win32 WaitForSingleObject(thread, INFINITE) is allowed multiple times, though<BR>
that isn't the current implementation.<BR>
<BR> - Jay<BR> <BR>
<HR id=stopSpelling>
From: hosking@cs.purdue.edu<BR>To: jay.krell@cornell.edu<BR>Date: Mon, 2 Nov 2009 12:59:36 -0500<BR>CC: m3devel@elegosoft.com<BR>Subject: Re: [M3devel] join twice?<BR><BR>I don't know that there ever was a mandate that join can only be called once on a given thread. But, given that pthread_join is undefined when called more than once on the same thread we probably want to retain the comment. (Whether the implementation actually prohibits it or not is an implementation decision.) The point is that we should be free to give the error in some later implementation, so as to not to restrict what semantics the implementation must support.
<DIV><BR>
<DIV><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span>
<DIV style="WORD-WRAP: break-word"><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span>
<DIV style="WORD-WRAP: break-word"><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span>
<DIV><FONT class=ecxApple-style-span color=#0000ff><FONT class=ecxApple-style-span face="Gill Sans"><SPAN style="FONT-FAMILY: 'Gill Sans'; COLOR: rgb(0,0,255)" class=ecxApple-style-span><SPAN style="FONT-FAMILY: 'Gill Sans'; COLOR: rgb(0,0,255)" class=ecxApple-style-span>Antony Hosking</SPAN></SPAN></FONT></FONT><FONT class=ecxApple-style-span face="Gill Sans"><SPAN style="FONT-FAMILY: 'Gill Sans'" class=ecxApple-style-span><SPAN style="FONT-FAMILY: 'Gill Sans'" class=ecxApple-style-span><SPAN class=ecxApple-converted-space> </SPAN>|<SPAN class=ecxApple-converted-space> </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 'Gill Sans'" class=ecxApple-style-span><SPAN style="FONT-FAMILY: 'Gill Sans'" class=ecxApple-style-span>Associate Professor</SPAN></SPAN><SPAN style="FONT-FAMILY: 'Gill Sans'" class=ecxApple-style-span><SPAN style="FONT-FAMILY: 'Gill Sans'" class=ecxApple-style-span> | Computer Science | Purdue University</SPAN></SPAN></FONT></DIV>
<DIV><FONT class=ecxApple-style-span face=GillSans-Light><SPAN style="FONT-FAMILY: GillSans-Light" class=ecxApple-style-span>305 N. University Street | West Lafayette | IN 47907 | USA</SPAN></FONT></DIV>
<DIV><FONT class=ecxApple-style-span color=#0000ff face="Gill Sans"><SPAN style="FONT-FAMILY: 'Gill Sans'; COLOR: rgb(0,0,255)" class=ecxApple-style-span><SPAN style="FONT-FAMILY: 'Gill Sans'; COLOR: rgb(0,0,255)" class=ecxApple-style-span>Office</SPAN></SPAN></FONT><FONT class=ecxApple-style-span face=GillSans-Light><SPAN style="FONT-FAMILY: GillSans-Light" class=ecxApple-style-span><SPAN style="FONT-FAMILY: GillSans-Light" class=ecxApple-style-span> +1 765 494 6001 |<SPAN class=ecxApple-converted-space> </SPAN></SPAN></SPAN></FONT><FONT class=ecxApple-style-span color=#0000ff face="Gill Sans"><SPAN style="FONT-FAMILY: 'Gill Sans'; COLOR: rgb(0,0,255)" class=ecxApple-style-span><SPAN style="FONT-FAMILY: 'Gill Sans'; COLOR: rgb(0,0,255)" class=ecxApple-style-span>Mobile</SPAN></SPAN></FONT><FONT class=ecxApple-style-span face=GillSans-Light><SPAN style="FONT-FAMILY: GillSans-Light" class=ecxApple-style-span><SPAN style="FONT-FAMILY: GillSans-Light" class=ecxApple-style-span><SPAN class=ecxApple-converted-space> </SPAN>+1 765 427 5484</SPAN></SPAN></FONT></DIV>
<DIV><FONT class=ecxApple-style-span face=GillSans-Light><BR class=ecxkhtml-block-placeholder></FONT></DIV></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN><BR class=ecxApple-interchange-newline></SPAN></DIV></SPAN></DIV></SPAN><BR class=ecxApple-interchange-newline></DIV><BR>
<DIV>
<DIV>On 2 Nov 2009, at 10:11, Jay K wrote:</DIV><BR class=ecxApple-interchange-newline>
<BLOCKQUOTE><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span>
<DIV style="FONT-FAMILY: Verdana; FONT-SIZE: 10pt" class=ecxhmmessage>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></DIV></SPAN></BLOCKQUOTE></DIV><BR></DIV> </body>
</html>