<div><div dir="auto">Is it possible to make an execution that creates a threadid collision ?</div><br><div class="gmail_quote"><div>On Wed, Nov 1, 2017 at 6:52 PM Andrew Martin <<a href="mailto:andrew.thaddeus@gmail.com">andrew.thaddeus@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>I don't know. Since CInt is just a newtype wrapper around Int32, at the moment it seems limited to that. I'm not sure about the actual data structure that's being read from though. Int64 (or Word64) seems more appropriate since it's certainly possible to fork more than 4 billion threads in the lifetime of one haskell application. But my guess is that it's currently just backed by Int32.</div><div class="gmail_extra"></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 1, 2017 at 1:04 PM, David Feuer <span><<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">If there some concern a ThreadId could be bigger than an Int somewhere/somewhen? Should it be Int64? Or could it be variable size, suggesting whatever it is that backs SmallByteString?</div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_4277444736879328288h5">On Nov 1, 2017 10:54 AM, "Andrew Martin" <<a href="mailto:andrew.thaddeus@gmail.com" target="_blank">andrew.thaddeus@gmail.com</a>> wrote:<br type="attribution"></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_4277444736879328288h5"><div>ThreadId has a Show instance that makes uses the FFI to turn a ThreadId to a CInt:<div><br></div><div>    instance Show ThreadId where<br>       showsPrec d t =<br>            showString "ThreadId " .<br>            showsPrec d (getThreadId (id2TSO t))<br><br>    foreign import ccall unsafe "rts_getThreadId" getThreadId :: ThreadId# -> CInt</div><div><br></div><div>Can getThreadId be exported? This would make it possible to write a Hashable instance for ThreadId, and it would make it possible to use a ThreadId to index into an array (with modulus of course).</div><div><br><div class="m_4277444736879328288m_-3610613012666709266m_4517934594860387236gmail_signature">-Andrew Thaddeus Martin</div>
</div></div>
<br></div></div><span>_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
<br></span></blockquote></div></div>
</blockquote></div><br><br clear="all"><div><br></div></div><div class="gmail_extra">-- <br><div class="m_4277444736879328288gmail_signature" data-smartmail="gmail_signature">-Andrew Thaddeus Martin</div>
</div>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div></div>