summaryrefslogtreecommitdiff
path: root/rts/StgMiscClosures.cmm
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2013-01-28 11:15:08 -0500
committerSimon Marlow <marlowsd@gmail.com>2013-01-30 10:50:14 +0000
commita23661d242e8dd55007c4aee8a053f35de7705bd (patch)
treee55bb371b52998e870a252de8768aaf4d1de6849 /rts/StgMiscClosures.cmm
parent658817bf1b44e9be8a3857c09aae086bef937720 (diff)
downloadhaskell-a23661d242e8dd55007c4aee8a053f35de7705bd.tar.gz
STM: Only wake up once
Previously, threads blocked on an STM retry would be sent a wakeup message each time an unpark was requested. This could result in the accumulation of a large number of wake-up messages, which would slow wake-up once the sleeping thread is finally scheduled. Here, we introduce a new closure type, STM_AWOKEN, which marks a TSO which has been sent a wake-up message, allowing us to send only one wakeup.
Diffstat (limited to 'rts/StgMiscClosures.cmm')
-rw-r--r--rts/StgMiscClosures.cmm12
1 files changed, 12 insertions, 0 deletions
diff --git a/rts/StgMiscClosures.cmm b/rts/StgMiscClosures.cmm
index 4341013d5d..28a41ad681 100644
--- a/rts/StgMiscClosures.cmm
+++ b/rts/StgMiscClosures.cmm
@@ -547,6 +547,18 @@ INFO_TABLE_CONSTR(stg_END_TSO_QUEUE,0,0,0,CONSTR_NOCAF_STATIC,"END_TSO_QUEUE","E
CLOSURE(stg_END_TSO_QUEUE_closure,stg_END_TSO_QUEUE);
/* ----------------------------------------------------------------------------
+ STM_AWOKEN
+
+ This is a static nullary constructor (like []) that we use to mark a
+ thread waiting on an STM wakeup
+ ------------------------------------------------------------------------- */
+
+INFO_TABLE_CONSTR(stg_STM_AWOKEN,0,0,0,CONSTR_NOCAF_STATIC,"STM_AWOKEN","STM_AWOKEN")
+{ foreign "C" barf("STM_AWOKEN object entered!") never returns; }
+
+CLOSURE(stg_STM_AWOKEN_closure,stg_STM_AWOKEN);
+
+/* ----------------------------------------------------------------------------
Arrays
These come in two basic flavours: arrays of data (StgArrWords) and arrays of