From 5209b192558e4adf0baa0981c463dcff61ec0636 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 20 Sep 2011 15:34:47 -0700 Subject: [PATCH] rt: Rename rand() to isaac_rand() since the former prevents lots of standard headers from being included --- src/rt/isaac/rand.h | 4 ++-- src/rt/rust_builtin.cpp | 2 +- src/rt/rust_kernel.cpp | 2 +- src/rt/rust_scheduler.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rt/isaac/rand.h b/src/rt/isaac/rand.h index 018496f676ef..3da2d71b20b2 100644 --- a/src/rt/isaac/rand.h +++ b/src/rt/isaac/rand.h @@ -43,10 +43,10 @@ void isaac(randctx *r); /* ------------------------------------------------------------------------------ - Call rand(/o_ randctx *r _o/) to retrieve a single 32-bit random value + Call isaac_rand(/o_ randctx *r _o/) to retrieve a single 32-bit random value ------------------------------------------------------------------------------ */ -#define rand(r) \ +#define isaac_rand(r) \ (!(r)->randcnt-- ? \ (isaac(r), (r)->randcnt=RANDSIZ-1, (r)->randrsl[(r)->randcnt]) : \ (r)->randrsl[(r)->randcnt]) diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index ac6ef22d1f8a..c2fdce1081c4 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -151,7 +151,7 @@ rand_new(rust_task *task) extern "C" CDECL size_t rand_next(rust_task *task, randctx *rctx) { - return rand(rctx); + return isaac_rand(rctx); } extern "C" CDECL void diff --git a/src/rt/rust_kernel.cpp b/src/rt/rust_kernel.cpp index e5234b9d6f5d..347b7907b533 100644 --- a/src/rt/rust_kernel.cpp +++ b/src/rt/rust_kernel.cpp @@ -150,7 +150,7 @@ rust_kernel::fail() { rust_task_id rust_kernel::create_task(rust_task *spawner, const char *name) { - rust_scheduler *thread = threads[rand(&rctx) % num_threads]; + rust_scheduler *thread = threads[isaac_rand(&rctx) % num_threads]; rust_task *t = thread->create_task(spawner, name); { scoped_lock with(_kernel_lock); diff --git a/src/rt/rust_scheduler.cpp b/src/rt/rust_scheduler.cpp index 1cbb0fe45656..187cf3ce105e 100644 --- a/src/rt/rust_scheduler.cpp +++ b/src/rt/rust_scheduler.cpp @@ -179,7 +179,7 @@ rust_scheduler::schedule_task(int id) { // FIXME: in the face of failing tasks, this is not always right. // I(this, n_live_tasks() > 0); if (running_tasks.length() > 0) { - size_t k = rand(&rctx); + size_t k = isaac_rand(&rctx); // Look around for a runnable task, starting at k. for(size_t j = 0; j < running_tasks.length(); ++j) { size_t i = (j + k) % running_tasks.length();