summaryrefslogtreecommitdiff
path: root/rts/include
diff options
context:
space:
mode:
authorCheng Shao <astrohavoc@gmail.com>2022-10-23 12:15:38 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-11-11 00:26:55 -0500
commit65b82542b6b031cb63933944e35de317ffed7a06 (patch)
tree0aec2fd7aafc1b76228c432e5ad6ced39aacdaac /rts/include
parent65ba328539c3a6f0fa26a7dc182c2de450d836ea (diff)
downloadhaskell-65b82542b6b031cb63933944e35de317ffed7a06.tar.gz
rts: no timer for wasm32
Due to the lack of threads, on wasm32 there can't be a background timer that periodically resets the context switch flag. This patch disables timer for wasm32, and also makes the scheduler default to -C0 on wasm32 to avoid starving threads.
Diffstat (limited to 'rts/include')
-rw-r--r--rts/include/rts/Flags.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/rts/include/rts/Flags.h b/rts/include/rts/Flags.h
index eb38e80794..e33d97b17c 100644
--- a/rts/include/rts/Flags.h
+++ b/rts/include/rts/Flags.h
@@ -198,7 +198,19 @@ typedef struct _CONCURRENT_FLAGS {
*
* It is changed by the +RTS -V<secs> flag.
*/
+
+// Note [No timer on wasm32]
+// ~~~~~~~~~~~~~~~~~~~~~~~~~
+// Due to the lack of threads and preemption semantics, on wasm32
+// there can't be a background timer that periodically resets the
+// context switch flag. So it makes sense to make the scheduler
+// default to -C0 on wasm32 for better fairness and avoid starving
+// threads.
+#if defined(wasm32_HOST_ARCH)
+#define DEFAULT_TICK_INTERVAL USToTime(0)
+#else
#define DEFAULT_TICK_INTERVAL USToTime(10000)
+#endif
/*
* When linkerAlwaysPic is true, the runtime linker assume that all object