Skip to content
Snippets Groups Projects
Commit 8e964073 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

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

parent 85568234
No related branches found
No related tags found
1 merge request!411Use getticks() to get enough randomness when enqueing tasks without owners.
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment