<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-15">
<META content="MSHTML 6.00.6002.18100" name=GENERATOR></HEAD>
<BODY style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space">
<DIV>I guess I will need to go back and look at Nelson again, but is it possible that one of the subsequent editions of SPwM3 added this prohibition against multiple joins?  I seem to recall that some of the interfaces got a rework and were published after the first printing of the book, but that the community adopted these as a whole to be "the spec" for M3.  Maybe the comment in Thread.i3 became law at that point?</DIV>
<DIV> </DIV>
<DIV>In any event, I still argue that it doesn't make sense to do multiple joins and I agree with Mika that it is often a symptom of bad programming and we want the language to help us write less buggy code.  </DIV>
<DIV> </DIV>
<DIV>So, I would vote that we don't make any <U>changes</U> to permit multiple joins.  It may be true that the current implementation does not enforce the prohibition against multiple joins on all platforms simply because it was the easiest thing to do at the time.  In this case, I argue that the implementation is not being totally faithful to the specification; but if the programmer heeds the spec, then there is no consequence to the implementation's lack of enforcement.</DIV>
<DIV> </DIV>
<DIV><STRONG><U>Bottom line</U></STRONG>:  Let's not devolve from the noble position of doing the right thing simply because the implementation has been less than faithful.  Keep the comment and the prohibition and work toward improving the implementation <U>over time</U> to be faithful to the specification.  (Does that make me a "practical idealist"?)</DIV>
<DIV> </DIV>
<DIV>Regards,</DIV>
<DIV>Randy Coleburn<BR><BR>>>> Tony Hosking <hosking@cs.purdue.edu> 11/3/2009 11:09 AM >>><BR></DIV>
<DIV apple-content-edited="true"><SPAN class=Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0">
<DIV style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space"><SPAN class=Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto">
<DIV style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space"><SPAN class=Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto"><SPAN class=Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto"><SPAN class=Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto"><SPAN class=Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto"><SPAN class=Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto"><SPAN class=Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto"><SPAN class=Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto"><SPAN class=Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto">
<DIV><SPAN class=Apple-style-span style="FONT-SIZE: medium">On 3 Nov 2009, at 10:49, Randy Coleburn wrote:</SPAN></DIV></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></DIV></SPAN></DIV></SPAN></DIV>
<DIV><BR class=Apple-interchange-newline>
<BLOCKQUOTE type="cite"><SPAN class=Apple-style-span style="WORD-SPACING: 0px; FONT: medium Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">
<DIV class=hmmessage style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">
<DIV>Understand the part about being "torn".</DIV>
<DIV> </DIV>
<DIV>I for one, have always programmed with the understanding that the comment was enforced.</DIV>
<DIV> </DIV>
<DIV>IMO:  If one needs to pass the result of a thread outside the thread's context, one should use an explicit mechanism or data structure (e.g., conditions, object data fields, etc.).</DIV>
<DIV> </DIV>
<DIV>If multiple threads need to wait for a thread to finish, that is the whole concept of a rendevous (see the "Little Book of Semaphores" you referenced earlier). </DIV></DIV></SPAN></BLOCKQUOTE>
<DIV><BR></DIV>
<DIV>Agreed.</DIV><BR>
<BLOCKQUOTE type="cite"><SPAN class=Apple-style-span style="WORD-SPACING: 0px; FONT: medium Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">
<DIV class=hmmessage style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">
<DIV> If programmers must depend on multiple joins, when is it ever safe for the underlying infrastructure to "forget about" the dead thread and its return value(s), if any?  At what point has it been "too long" for you to query about a dead thread's status/return values (millisecs, minutes, hours, days, weeks -- for long-running programs this can be problematic).</DIV></DIV></SPAN></BLOCKQUOTE>
<DIV><BR></DIV>
<DIV>We can forget about the dead thread only when it is GC'd.  No-one can call Join without a reference to it.</DIV><BR>
<BLOCKQUOTE type="cite"><SPAN class=Apple-style-span style="WORD-SPACING: 0px; FONT: medium Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">
<DIV class=hmmessage style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">
<DIV> I would argue that it is better for the programmer to be explicit in such matters.  It is easy enough to implement given the capabilities of the language, and indeed, I've done so many times.</DIV></DIV></SPAN></BLOCKQUOTE>
<DIV><BR></DIV>
<DIV>Agreed.  The odd thing is just that the old "reference" user-level threads implementation never did the check, and permitted multiple joins.  And the threads spec in SPwM3 is silent on the issue.</DIV><BR>
<BLOCKQUOTE type="cite"><SPAN class=Apple-style-span style="WORD-SPACING: 0px; FONT: medium Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">
<DIV class=hmmessage style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">
<DIV>Regards,</DIV>
<DIV>Randy Coleburn<BR><BR>>>> Jay K <<A href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</A>> 11/3/2009 10:04 AM >>><BR>To me..with a Win32 background..join means "wait for thread to finish".<BR>And there is a separate action "get thread result".<BR>You could consider these one merged operation "wait for thread to finish and get its result".<BR>In either case, it is reasonable to allow it multiple times.<BR>Waiting for a thread to finish that has already finished is just fast.<BR>Getting a thread result that you already got is also easy albeit usually unnecessary.<BR> <BR>Now, if the operation is "wait for thread to finish, get its result, and lose track of its result",<BR>that isn't idempotent.<BR> <BR>I'm torn. The existing implementations all either support multiple join or have to go out of<BR>their way to prevent it. Yet Thread.i3 has been commented so presumably forever.<BR> <BR> - Jay<BR><BR> <BR></DIV>
<DIV>
<HR id=stopSpelling>
</DIV>
<DIV>Date: Tue, 3 Nov 2009 09:36:23 -0500<BR>From:<SPAN class=Apple-converted-space> </SPAN><A href="mailto:rcoleburn@scires.com">rcoleburn@scires.com</A><BR>To:<SPAN class=Apple-converted-space> </SPAN><A href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</A><BR>Subject: Re: [M3devel] join twice?<BR><BR></DIV>
<DIV>I think the comment in the code is correct.</DIV>
<DIV> </DIV>
<DIV>Semantically, it doesn't make sense to join a thread more than once.  Join is the compliment to Fork.  With fork, one thread becomes two.  With Join, two threads become one.  After they've become one, the 2nd thread is no more, so you can't join to it anymore.</DIV>
<DIV> </DIV>
<DIV>IMO, the implementation should enforce this behavior.  What would be the "benefit" of allowing more than one join?  What does it "mean" to join a "dead thread"?</DIV>
<DIV> </DIV>
<DIV>Regards,</DIV>
<DIV>Randy Coleburn<BR><BR>>>> Tony Hosking <<A href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</A>> 11/2/2009 11:54 PM >>><BR></DIV>
<DIV><SPAN class=ecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV style="WORD-WRAP: break-word"><SPAN class=ecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV style="WORD-WRAP: break-word"><SPAN class=ecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=ecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=ecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=ecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=ecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=ecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=ecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=ecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV><FONT class=ecxApple-style-span face="'Gill Sans'" color=#0000ff><SPAN class=ecxApple-style-span style="FONT-SIZE: medium">OK, sure.  Fair enough.</SPAN></FONT></DIV></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></DIV></SPAN></DIV></SPAN></DIV><BR>
<DIV>
<DIV>On 2 Nov 2009, at 16:43, Jay K wrote:</DIV><BR class=ecxApple-interchange-newline>
<BLOCKQUOTE><SPAN class=ecxApple-style-span style="WORD-SPACING: 0px; FONT: medium Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV class=ecxhmmessage style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"> > (Whether the implementation actually prohibits it or not is an implementation decision.) <SPAN class=ecxApple-converted-space> </SPAN><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=ecxstopSpelling>
From:<SPAN class=ecxApple-converted-space> </SPAN><A href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</A><BR>To:<SPAN class=ecxApple-converted-space> </SPAN><A href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</A><BR>Date: Mon, 2 Nov 2009 12:59:36 -0500<BR>CC:<SPAN class=ecxApple-converted-space> </SPAN><A href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</A><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 class=ecxecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV style="WORD-WRAP: break-word"><SPAN class=ecxecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV style="WORD-WRAP: break-word"><SPAN class=ecxecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=ecxecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=ecxecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=ecxecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=ecxecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=ecxecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=ecxecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=ecxecxApple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV><FONT class=ecxecxApple-style-span color=#0000ff><FONT class=ecxecxApple-style-span face="Gill Sans"><SPAN class=ecxecxApple-style-span style="COLOR: rgb(0,0,255); FONT-FAMILY: 'Gill Sans'"><SPAN class=ecxecxApple-style-span style="COLOR: rgb(0,0,255); FONT-FAMILY: 'Gill Sans'">Antony Hosking</SPAN></SPAN></FONT></FONT><FONT class=ecxecxApple-style-span face="Gill Sans"><SPAN class=ecxecxApple-style-span style="FONT-FAMILY: 'Gill Sans'"><SPAN class=ecxecxApple-style-span style="FONT-FAMILY: 'Gill Sans'"><SPAN class=ecxecxApple-converted-space> </SPAN>|<SPAN class=ecxecxApple-converted-space> </SPAN></SPAN></SPAN><SPAN class=ecxecxApple-style-span style="FONT-FAMILY: 'Gill Sans'"><SPAN class=ecxecxApple-style-span style="FONT-FAMILY: 'Gill Sans'">Associate Professor</SPAN></SPAN><SPAN class=ecxecxApple-style-span style="FONT-FAMILY: 'Gill Sans'"><SPAN class=ecxecxApple-style-span style="FONT-FAMILY: 'Gill Sans'"> | Computer Science | Purdue University</SPAN></SPAN></FONT></DIV>
<DIV><FONT class=ecxecxApple-style-span face=GillSans-Light><SPAN class=ecxecxApple-style-span style="FONT-FAMILY: GillSans-Light">305 N. University Street | West Lafayette | IN 47907 | USA</SPAN></FONT></DIV>
<DIV><FONT class=ecxecxApple-style-span face="Gill Sans" color=#0000ff><SPAN class=ecxecxApple-style-span style="COLOR: rgb(0,0,255); FONT-FAMILY: 'Gill Sans'"><SPAN class=ecxecxApple-style-span style="COLOR: rgb(0,0,255); FONT-FAMILY: 'Gill Sans'">Office</SPAN></SPAN></FONT><FONT class=ecxecxApple-style-span face=GillSans-Light><SPAN class=ecxecxApple-style-span style="FONT-FAMILY: GillSans-Light"><SPAN class=ecxecxApple-style-span style="FONT-FAMILY: GillSans-Light"> +1 765 494 6001 |<SPAN class=ecxecxApple-converted-space> </SPAN></SPAN></SPAN></FONT><FONT class=ecxecxApple-style-span face="Gill Sans" color=#0000ff><SPAN class=ecxecxApple-style-span style="COLOR: rgb(0,0,255); FONT-FAMILY: 'Gill Sans'"><SPAN class=ecxecxApple-style-span style="COLOR: rgb(0,0,255); FONT-FAMILY: 'Gill Sans'">Mobile</SPAN></SPAN></FONT><FONT class=ecxecxApple-style-span face=GillSans-Light><SPAN class=ecxecxApple-style-span style="FONT-FAMILY: GillSans-Light"><SPAN class=ecxecxApple-style-span style="FONT-FAMILY: GillSans-Light"><SPAN class=ecxecxApple-converted-space> </SPAN>+1 765 427 5484</SPAN></SPAN></FONT></DIV>
<DIV><FONT class=ecxecxApple-style-span face=GillSans-Light><BR class=ecxecxkhtml-block-placeholder></FONT></DIV></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN><BR class=ecxecxApple-interchange-newline></SPAN></DIV></SPAN></DIV></SPAN><BR class=ecxecxApple-interchange-newline></DIV><BR>
<DIV>
<DIV>On 2 Nov 2009, at 10:11, Jay K wrote:</DIV><BR class=ecxecxApple-interchange-newline>
<BLOCKQUOTE><SPAN class=ecxecxApple-style-span style="WORD-SPACING: 0px; FONT: medium Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV class=ecxecxhmmessage style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">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></DIV></SPAN><BR class=ecxApple-interchange-newline></BLOCKQUOTE></DIV><BR></DIV></SPAN><BR class=Apple-interchange-newline></BLOCKQUOTE></DIV><BR></BODY></HTML>