ThreadId to Int
Carter Schonwald
carter.schonwald at gmail.com
Thu Nov 2 02:29:49 UTC 2017
Is it possible to make an execution that creates a threadid collision ?
On Wed, Nov 1, 2017 at 6:52 PM Andrew Martin <andrew.thaddeus at gmail.com>
wrote:
> 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.
>
> On Wed, Nov 1, 2017 at 1:04 PM, David Feuer <david.feuer at gmail.com> wrote:
>
>> 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?
>>
>> On Nov 1, 2017 10:54 AM, "Andrew Martin" <andrew.thaddeus at gmail.com>
>> wrote:
>>
>>> ThreadId has a Show instance that makes uses the FFI to turn a ThreadId
>>> to a CInt:
>>>
>>> instance Show ThreadId where
>>> showsPrec d t =
>>> showString "ThreadId " .
>>> showsPrec d (getThreadId (id2TSO t))
>>>
>>> foreign import ccall unsafe "rts_getThreadId" getThreadId ::
>>> ThreadId# -> CInt
>>>
>>> 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).
>>>
>>> -Andrew Thaddeus Martin
>>>
>>> _______________________________________________
>>> Libraries mailing list
>>> Libraries at haskell.org
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>>>
>>>
>
>
> --
> -Andrew Thaddeus Martin
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20171102/10f92e3c/attachment-0001.html>
More information about the Libraries
mailing list