<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div>Sorry, yes, you are correct that the value NULL will also be NIL.  So, setspecific NIL is unnecessary.</div><div><br></div><div>In any case, I do think we should just move the handler stack into Activation and pare things back to just the one threadlocal per thread.</div><div><br></div></span></span></span></span></span></span></span></span></div></span></div><div><div>On 19 Mar 2009, at 12:02, Jay wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -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 class="hmmessage" style="font-size: 10pt; font-family: Verdana; ">But doesn't pthread_create make it so? (More so, it makes it so on any new threads.)<br>Or it that not portable? Or did I misunderstand the opengroup web page? Or other?<br>Or, is this because, like, the Modula-3 notion of "NIL" might not match the pthread notion of "NULL"? I don't believe in that extreme level of portability/disbelief/theory, but...<br>Unless someone can tell me about such a system.. in which<br> void* p = 0;<span class="Apple-converted-space"> </span><br> printf("%p\n", p);<br> memset(&p, 0, sizeof(p));<span class="Apple-converted-space"> </span><br> printf("%p\n", q);<span class="Apple-converted-space"> </span><br> <br>doesn't print two identical lines.<br> <br>I know the C standard does not guarantee this, and probably therefore Modula-3 doesn't either, but I've never heard of a system on which this isn't true.<br>It seems more theoretical than, say, non-IEEE floating point math (which I believe exists on VAX), or, say, 16 bit integers...<br> <br> - Jay<br><br> <br>> From:<span class="Apple-converted-space"> </span><a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a><br>> To:<span class="Apple-converted-space"> </span><a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a><br>> Date: Thu, 19 Mar 2009 10:22:59 +1100<br>> CC:<span class="Apple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>> Subject: Re: [M3devel] pthreads tls initialization?<br>><span class="Apple-converted-space"> </span><br>> The setspecific call is to initialize the handler stack to nil. It is<span class="Apple-converted-space"> </span><br>> needed.<br>><span class="Apple-converted-space"> </span><br>> On 19 Mar 2009, at 01:33, Jay wrote:<br>><span class="Apple-converted-space"> </span><br>> ><br>> ><span class="Apple-converted-space"> </span><a href="http://www.opengroup.org/onlinepubs/000095399/functions/pthread_key_create.html">http://www.opengroup.org/onlinepubs/000095399/functions/pthread_key_create.html</a><br>> ><br>> ><br>> > says that thread locals start as zero, but ThreadPThread.m3 does:<br>> ><br>> ><br>> > PROCEDURE InitHandlers () =<br>> > BEGIN<br>> > WITH r = pthread_key_create_handlers() DO END;<br>> > WITH r = pthread_setspecific_handlers(NIL) DO END;<br>> > initHandlers := FALSE;<br>> > END InitHandlers;<br>> ><br>> ><br>> > Any reason for that setspecific call?<br>> ><br>> ><br>> > I ask because I think some of this code should just be written in C.<br>> > But ideally then, the Win32 code should be too.<br>> > So I'm just reading them, and they differ oddly in that pthread<span class="Apple-converted-space"> </span><br>> > keeps doing like:<br>> ><br>> ><br>> > if not initialized Initialize()<br>> ><br>> ><br>> > and Win32 allocates its thread up front locals via the Modula<span class="Apple-converted-space"> </span><br>> > initializer.<br>> > Maybe pthread_key is very expensive, and avoided in single threaded<span class="Apple-converted-space"> </span><br>> > apps?<br>> > But there aren't any, right, because the runtime creates threads, at<span class="Apple-converted-space"> </span><br>> > least one for the garbage collector?<br>> ><br>> ><br>> > - Jay<br>><span class="Apple-converted-space"> </span><br></div></span></blockquote></div><br></body></html>