summaryrefslogtreecommitdiff
path: root/compiler/GHC
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-07-16 14:05:46 -0400
committerBen Gamari <ben@smart-cactus.org>2022-08-06 11:54:52 -0400
commit1472044ba587b575372102bbb0c8cc4d85df74db (patch)
tree0b47d69aacae487048189d365d116e8df389d252 /compiler/GHC
parent6d1700b6dca6defb8768c493a1059c4215749b53 (diff)
downloadhaskell-1472044ba587b575372102bbb0c8cc4d85df74db.tar.gz
Add a primop to query the label of a thread
Diffstat (limited to 'compiler/GHC')
-rw-r--r--compiler/GHC/Builtin/primops.txt.pp10
-rw-r--r--compiler/GHC/StgToCmm/Prim.hs1
2 files changed, 11 insertions, 0 deletions
diff --git a/compiler/GHC/Builtin/primops.txt.pp b/compiler/GHC/Builtin/primops.txt.pp
index 13c53b493b..d46e5401fb 100644
--- a/compiler/GHC/Builtin/primops.txt.pp
+++ b/compiler/GHC/Builtin/primops.txt.pp
@@ -2938,6 +2938,16 @@ primop NoDuplicateOp "noDuplicate#" GenPrimOp
out_of_line = True
has_side_effects = True
+primop GetThreadLabelOp "threadLabel#" GenPrimOp
+ ThreadId# -> State# RealWorld -> (# State# RealWorld, Int#, ByteArray# #)
+ {Get the label of the given thread.
+ Morally of type @ThreadId# -> IO (Maybe ByteArray#)@, with a @1#@ tag
+ denoting @Just@.
+
+ @since 0.10}
+ with
+ out_of_line = True
+
primop ThreadStatusOp "threadStatus#" GenPrimOp
ThreadId# -> State# RealWorld -> (# State# RealWorld, Int#, Int#, Int# #)
{Get the status of the given thread. Result is
diff --git a/compiler/GHC/StgToCmm/Prim.hs b/compiler/GHC/StgToCmm/Prim.hs
index b0abef9f4e..1d482b0143 100644
--- a/compiler/GHC/StgToCmm/Prim.hs
+++ b/compiler/GHC/StgToCmm/Prim.hs
@@ -1597,6 +1597,7 @@ emitPrimOp cfg primop =
LabelThreadOp -> alwaysExternal
IsCurrentThreadBoundOp -> alwaysExternal
NoDuplicateOp -> alwaysExternal
+ GetThreadLabelOp -> alwaysExternal
ThreadStatusOp -> alwaysExternal
MkWeakOp -> alwaysExternal
MkWeakNoFinalizerOp -> alwaysExternal