Revert "random task" as it's not efficient compared to simply taking the top task
This reverts commit 274c2d6160
.
This commit is contained in:
parent
a7d1ca5964
commit
9ebd5e0a2d
1 changed files with 1 additions and 10 deletions
11
src/sched.c
11
src/sched.c
|
@ -71,9 +71,6 @@ sched_init(int nthreads, int qlen, taskfunc f, void *closure)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialise l'aléatoire
|
|
||||||
srand(time(NULL));
|
|
||||||
|
|
||||||
pthread_t threads[nthreads];
|
pthread_t threads[nthreads];
|
||||||
for(int i = 0; i < nthreads; ++i) {
|
for(int i = 0; i < nthreads; ++i) {
|
||||||
if(pthread_create(&threads[i], NULL, sched_worker, &sched) != 0) {
|
if(pthread_create(&threads[i], NULL, sched_worker, &sched) != 0) {
|
||||||
|
@ -158,13 +155,7 @@ sched_worker(void *arg)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extrait une tâche aléatoire de la liste
|
// Extrait la tâche de la pile
|
||||||
int random_index = rand() % (s->top + 1);
|
|
||||||
|
|
||||||
struct task_info echange = s->tasks[random_index];
|
|
||||||
s->tasks[random_index] = s->tasks[s->top];
|
|
||||||
s->tasks[s->top] = echange;
|
|
||||||
|
|
||||||
taskfunc f = s->tasks[s->top].f;
|
taskfunc f = s->tasks[s->top].f;
|
||||||
void *closure = s->tasks[s->top].closure;
|
void *closure = s->tasks[s->top].closure;
|
||||||
s->top--;
|
s->top--;
|
||||||
|
|
Reference in a new issue