Skip to content
Snippets Groups Projects
Commit 613867a2 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

queue_gettask no longer needs to know what the qid is.

Former-commit-id: e3b091df016a5439da38e5e8ec3eee8587531e43
parent cfa54797
No related branches found
No related tags found
No related merge requests found
...@@ -130,7 +130,7 @@ void queue_init ( struct queue *q , struct task *tasks ) { ...@@ -130,7 +130,7 @@ void queue_init ( struct queue *q , struct task *tasks ) {
* @param keep Remove the returned task from this queue. * @param keep Remove the returned task from this queue.
*/ */
struct task *queue_gettask ( struct queue *q , int qid , struct cell *super , int blocking ) { struct task *queue_gettask ( struct queue *q , struct cell *super , int blocking ) {
int k, temp, qcount, *qtid, gotcha; int k, temp, qcount, *qtid, gotcha;
lock_type *qlock = &q->lock; lock_type *qlock = &q->lock;
......
...@@ -51,6 +51,6 @@ struct queue { ...@@ -51,6 +51,6 @@ struct queue {
/* Function prototypes. */ /* Function prototypes. */
struct task *queue_gettask ( struct queue *q , int qid , struct cell *super , int blocking ); struct task *queue_gettask ( struct queue *q , struct cell *super , int blocking );
void queue_init ( struct queue *q , struct task *tasks ); void queue_init ( struct queue *q , struct task *tasks );
void queue_insert ( struct queue *q , struct task *t ); void queue_insert ( struct queue *q , struct task *t );
...@@ -850,7 +850,7 @@ struct task *scheduler_gettask ( struct scheduler *s , int qid , struct cell *su ...@@ -850,7 +850,7 @@ struct task *scheduler_gettask ( struct scheduler *s , int qid , struct cell *su
for ( int tries = 0 ; res == NULL && s->waiting && tries < scheduler_maxtries ; tries++ ) { for ( int tries = 0 ; res == NULL && s->waiting && tries < scheduler_maxtries ; tries++ ) {
/* Try to get a task from the suggested queue. */ /* Try to get a task from the suggested queue. */
if ( s->queues[qid].count > 0 && ( res = queue_gettask( &s->queues[qid] , qid , super , 1 ) ) != NULL ) if ( s->queues[qid].count > 0 && ( res = queue_gettask( &s->queues[qid] , super , 1 ) ) != NULL )
break; break;
/* If unsucessful, try stealing from the other queues. */ /* If unsucessful, try stealing from the other queues. */
...@@ -861,7 +861,7 @@ struct task *scheduler_gettask ( struct scheduler *s , int qid , struct cell *su ...@@ -861,7 +861,7 @@ struct task *scheduler_gettask ( struct scheduler *s , int qid , struct cell *su
qids[ count++ ] = k; qids[ count++ ] = k;
for ( k = 0 ; k < scheduler_maxsteal && count > 0 ; k++ ) { for ( k = 0 ; k < scheduler_maxsteal && count > 0 ; k++ ) {
int ind = rand() % count; int ind = rand() % count;
if ( ( res = queue_gettask( &s->queues[ qids[ ind ] ] , qid , super , 0 ) ) != NULL ) if ( ( res = queue_gettask( &s->queues[ qids[ ind ] ] , super , 0 ) ) != NULL )
break; break;
else else
qids[ ind ] = qids[ --count ]; qids[ ind ] = qids[ --count ];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment