Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
8e964073
Commit
8e964073
authored
Aug 29, 2017
by
Matthieu Schaller
Browse files
Use getticks() to get enough randomness when enqueing tasks without owners.
parent
85568234
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/scheduler.c
View file @
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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment