summaryrefslogtreecommitdiff
path: root/rts/posix/Select.c
diff options
context:
space:
mode:
authorPaolo Capriotti <p.capriotti@gmail.com>2012-03-20 11:57:28 +0000
committerPaolo Capriotti <p.capriotti@gmail.com>2012-04-16 15:18:19 +0100
commit5ba7db93fb634ff8094f42780a14972322446a94 (patch)
tree7f460341d5e7aa16f8f6e361c5d2db74bd6c530b /rts/posix/Select.c
parent3377abeb6bd4623c5806936d0ee569d123c1aa59 (diff)
downloadhaskell-5ba7db93fb634ff8094f42780a14972322446a94.tar.gz
Use monotonic clock in Select.c (#5865)
Diffstat (limited to 'rts/posix/Select.c')
-rw-r--r--rts/posix/Select.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/rts/posix/Select.c b/rts/posix/Select.c
index a2a66a6b8a..5acb8174da 100644
--- a/rts/posix/Select.c
+++ b/rts/posix/Select.c
@@ -20,6 +20,7 @@
#include "Select.h"
#include "AwaitEvent.h"
#include "Stats.h"
+#include "GetTime.h"
# ifdef HAVE_SYS_SELECT_H
# include <sys/select.h>
@@ -29,16 +30,10 @@
# include <sys/types.h>
# endif
-# ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-# endif
-
#include <errno.h>
#include <string.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
+#include "Clock.h"
#if !defined(THREADED_RTS)
@@ -64,7 +59,7 @@
*/
static LowResTime getLowResTimeOfDay(void)
{
- return TimeToLowResTimeRoundDown(stat_getElapsedTime());
+ return TimeToLowResTimeRoundDown(getProcessElapsedTime());
}
/*
@@ -74,7 +69,7 @@ LowResTime getDelayTarget (HsInt us)
{
// round up the target time, because we never want to sleep *less*
// than the desired amount.
- return TimeToLowResTimeRoundUp(stat_getElapsedTime() + USToTime(us));
+ return TimeToLowResTimeRoundUp(getProcessElapsedTime() + USToTime(us));
}
/* There's a clever trick here to avoid problems when the time wraps
@@ -277,7 +272,7 @@ awaitEvent(rtsBool wait)
/* check for threads that need waking up
*/
wakeUpSleepingThreads(getLowResTimeOfDay());
-
+
/* If new runnable threads have arrived, stop waiting for
* I/O and run them.
*/