ThreadId to Int

Eric Seidel eric at seidel.io
Wed Nov 1 14:59:20 UTC 2017


I recently ran into this issue too, this would be a nice change!

On Wed, Nov 1, 2017, at 10:53, Andrew Martin 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


More information about the Libraries mailing list