aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-07-04 21:18:47 -0700
committerGraydon Hoare <[email protected]>2010-07-04 21:18:47 -0700
commit2a413070c66911e9a5211d271c704d4c7f03b49a (patch)
treec05df70525584534cb772f6661a9fd53d8773c99 /src
parentFix bug in win32 command-line arg processing. (diff)
downloadrust-2a413070c66911e9a5211d271c704d4c7f03b49a.tar.xz
rust-2a413070c66911e9a5211d271c704d4c7f03b49a.zip
Preempt works on non-windows, just needed a little valgrind love to complete in a reasonable time.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile3
-rw-r--r--src/rt/rust_timer.cpp12
2 files changed, 10 insertions, 5 deletions
diff --git a/src/Makefile b/src/Makefile
index 120513f4..c21dcc69 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -483,9 +483,6 @@ TEST_XFAILS_LLVM := $(addprefix test/run-pass/, \
ifdef CFG_WINDOWSY
TEST_XFAILS_X86 += test/run-pass/native-mod.rc
TEST_XFAILS_LLVM += test/run-pass/native-mod.rc
-else
-TEST_XFAILS_X86 += test/run-pass/preempt.rs
-TEST_XFAILS_LLVM += test/run-pass/preempt.rs
endif
RPASS_RC := $(wildcard test/run-pass/*.rc)
diff --git a/src/rt/rust_timer.cpp b/src/rt/rust_timer.cpp
index 7950c021..997fbb51 100644
--- a/src/rt/rust_timer.cpp
+++ b/src/rt/rust_timer.cpp
@@ -1,5 +1,6 @@
#include "rust_internal.h"
+#include "valgrind.h"
// The mechanism in this file is very crude; every domain (thread) spawns its
// own secondary timer thread, and that timer thread *never idles*. It
@@ -32,11 +33,15 @@ timer_loop(void *ptr)
rust_timer *timer = (rust_timer *)ptr;
rust_dom &dom = timer->dom;
dom.log(rust_log::TIMER, "in timer 0x%" PRIxPTR, (uintptr_t)timer);
+ size_t ms = TIME_SLICE_IN_MS;
+ if (!RUNNING_ON_VALGRIND)
+ ms = 1;
+
while (!timer->exit_flag) {
#if defined(__WIN32__)
- Sleep(TIME_SLICE_IN_MS);
+ Sleep(ms);
#else
- usleep(TIME_SLICE_IN_MS * 1000);
+ usleep(ms * 1000);
#endif
dom.log(rust_log::TIMER,
"timer 0x%" PRIxPTR
@@ -65,6 +70,9 @@ rust_timer::rust_timer(rust_dom &dom) : dom(dom), exit_flag(0)
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
pthread_create(&thread, &attr, timer_loop, (void *)this);
#endif
+ if (RUNNING_ON_VALGRIND) {
+ usleep(10000);
+ }
}
rust_timer::~rust_timer()