[Git][ghc/ghc][master] base: Export GHC.Conc.Sync.fromThreadId
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Thu May 11 08:10:35 UTC 2023
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
0a513952 by Ben Gamari at 2023-05-11T04:10:17-04:00
base: Export GHC.Conc.Sync.fromThreadId
Closes #22706.
- - - - -
2 changed files:
- libraries/base/GHC/Conc/Sync.hs
- libraries/base/changelog.md
Changes:
=====================================
libraries/base/GHC/Conc/Sync.hs
=====================================
@@ -33,6 +33,7 @@ module GHC.Conc.Sync
(
-- * Threads
ThreadId(..)
+ , fromThreadId
, showThreadId
, myThreadId
, killThread
@@ -148,11 +149,18 @@ garbage collected until you drop the 'ThreadId'. This misfeature would
be difficult to correct while continuing to support 'threadStatus'.
-}
+-- | Map a thread to an integer identifier which is unique within the
+-- current process.
+--
+-- @since 4.19.0.0
+fromThreadId :: ThreadId -> Word64
+fromThreadId tid = fromIntegral $ getThreadId (id2TSO tid)
+
-- | @since 4.2.0.0
instance Show ThreadId where
showsPrec d t = showParen (d >= 11) $
showString "ThreadId " .
- showsPrec d (getThreadId (id2TSO t))
+ showsPrec d (fromThreadId t)
showThreadId :: ThreadId -> String
showThreadId = show
=====================================
libraries/base/changelog.md
=====================================
@@ -4,6 +4,7 @@
* Add `{-# WARNING in "x-partial" #-}` to `Data.List.{head,tail}`.
Use `{-# OPTIONS_GHC -Wno-x-partial #-}` to disable it.
([CLC proposal #87](https://github.com/haskell/core-libraries-committee/issues/87) and [#114](https://github.com/haskell/core-libraries-committee/issues/114))
+ * `GHC.Conc.Sync` now exports `fromThreadId :: ThreadId -> Word64`, which maps a thread to a per-process-unique identifier ([CLC proposal #117](https://github.com/haskell/core-libraries-committee/issues/117))
* Add `Data.List.!?` ([CLC proposal #110](https://github.com/haskell/core-libraries-committee/issues/110))
* `maximumBy`/`minimumBy` are now marked as `INLINE` improving performance for unpackable
types significantly.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0a5139522394b901276ffa71283f01420e270746
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0a5139522394b901276ffa71283f01420e270746
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230511/4da5673d/attachment-0001.html>
More information about the ghc-commits
mailing list