Commit be949fab authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'rand_fix2' into 'master'

Use getticks() to get enough randomness when enqueing tasks without owners.

How about this version ?

See merge request !411
parents 85568234 8e964073
......@@ -1381,9 +1381,8 @@ void scheduler_enqueue(struct scheduler *s, struct task *t) {
if (qid >= s->nr_queues) error("Bad computed qid.");
/* If no previous owner, pick a random queue. */
if (qid < 0)
qid = rand_r((unsigned int *)pthread_getspecific(s->local_seed_pointer)) %
s->nr_queues;
/* Note that getticks() is random enough */
if (qid < 0) qid = getticks() % s->nr_queues;
/* Increase the waiting counter. */
atomic_inc(&s->waiting);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment