ThreadId to Int

David Feuer david.feuer at gmail.com
Wed Nov 1 17:04:02 UTC 2017


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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20171101/69f11666/attachment.html>


More information about the Libraries mailing list