[Git][ghc/ghc][wip/js-staging] Implement h$sleep (T5611)
Sylvain Henry (@hsyl20)
gitlab at gitlab.haskell.org
Wed Sep 28 14:03:06 UTC 2022
Sylvain Henry pushed to branch wip/js-staging at Glasgow Haskell Compiler / GHC
Commits:
d1002769 by Sylvain Henry at 2022-09-28T16:06:19+02:00
Implement h$sleep (T5611)
- - - - -
1 changed file:
- rts/js/thread.js
Changes:
=====================================
rts/js/thread.js
=====================================
@@ -185,8 +185,16 @@ function h$wakeupDelayed(now) {
}
function h$delayThread(time) {
- var now = Date.now();
var ms = time/1000; // we have no microseconds in JS
+ return h$delayThreadMs(ms);
+}
+
+function h$sleep(secs) {
+ return h$delayThreadMs(secs*1000);
+}
+
+function h$delayThreadMs(ms) {
+ var now = Date.now();
TRACE_SCHEDULER("delaying " + h$threadString(h$currentThread) + " " + ms + "ms (" + (now+ms) + ")");
h$delayed.add(now+ms, h$currentThread);
h$currentThread.delayed = true;
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d1002769b3dfa7c1757684f15212e7fa4849c31f
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d1002769b3dfa7c1757684f15212e7fa4849c31f
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/20220928/cc75e8b9/attachment-0001.html>
More information about the ghc-commits
mailing list