rt: Rename rand() to isaac_rand() since the former prevents lots of standard headers from being included

This commit is contained in:
Patrick Walton 2011-09-20 15:34:47 -07:00
parent 307957710c
commit 5209b19255
4 changed files with 5 additions and 5 deletions

View file

@ -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])

View file

@ -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

View file

@ -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);

View file

@ -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();