[GHC] #10674: Expose OSThreadID and assorted functions from Haskell

GHC ghc-devs at haskell.org
Thu Jul 23 10:18:00 UTC 2015


#10674: Expose OSThreadID and assorted functions from Haskell
-------------------------------------+-------------------------------------
              Reporter:  Fuuzetsu    |             Owner:
                  Type:  feature     |            Status:  new
  request                            |
              Priority:  normal      |         Milestone:
             Component:  Compiler    |           Version:  7.10.1
              Keywords:              |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
             Test Case:              |        Blocked By:
              Blocking:              |   Related Tickets:
Differential Revisions:              |
-------------------------------------+-------------------------------------
 Currently given two {{{ThreadId}}}s, there is no way to tell without FFI
 if they are running on the same OS thread. There is not even a way to ask
 what OS thread we are currently on: something like {{{myThreadId}}} except
 {{{myOsThreadId}}}.

 Currently to remedy this, the user has to effectively copy and paste parts
 of the internal rts files and use something like {{{.hsc}}} with CPP to
 get at this information. This is not really portable on the user side and
 requires nasty gutting.

 In the RTS the function we are interested in is at least {{{osThreadId}}}:
 at least with this function we can inspect current {{{OSThreadId}}} and
 communicate it out through an {{{MVar}}} or otherwise.

 So this is a feature request for an abstract type {{{OSThreadId}}} with
 instances of at least {{{Eq, Show}}} and a function {{{myOsThreadId :: IO
 OSThreadId}}}.

 Nice to have would be {{{osThreadId :: ThreadID -> IO OSThreadId}}} but
 not critical. If there is room for optimisation in GHC, functions like
 {{{sameOsThread :: ThreadId -> ThreadId -> IO Bool}}} would also be nice
 but again not critical.

 Not sure what to set in ticket meta-data so please change as appropriate.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10674>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list