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
57882237
Commit
57882237
authored
Dec 03, 2012
by
Pedro Gonnet
Browse files
use queue_maxhits to avoid searching the queue for too long for the optimal task.
Former-commit-id: cd88dff0a0e24da4435d961ea4a8219f5af0db74
parent
26dc003b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/queue.c
View file @
57882237
...
...
@@ -269,7 +269,7 @@ struct task *queue_gettask_old ( struct queue *q , int blocking , int keep ) {
struct
task
*
queue_gettask
(
struct
queue
*
q
,
int
rid
,
int
blocking
,
int
keep
)
{
int
k
,
tid
=
-
1
,
qcount
,
*
qtid
=
q
->
tid
;
int
k
,
tid
=
-
1
,
qcount
,
*
qtid
=
q
->
tid
,
hits
=
0
;
lock_type
*
qlock
=
&
q
->
lock
;
struct
task
*
qtasks
=
q
->
tasks
,
*
res
=
NULL
;
struct
cell
*
ci_best
=
NULL
,
*
cj_best
=
NULL
;
...
...
@@ -297,7 +297,7 @@ struct task *queue_gettask ( struct queue *q , int rid , int blocking , int keep
/* Loop over the remaining task IDs. */
qcount
=
q
->
count
;
ind_best
=
-
1
;
for
(
k
=
q
->
next
;
k
<
qcount
;
k
++
)
{
for
(
k
=
q
->
next
;
k
<
qcount
&&
hits
<
queue_maxhits
;
k
++
)
{
/* Put a finger on the task. */
res
=
&
qtasks
[
qtid
[
k
]
];
...
...
@@ -347,6 +347,7 @@ struct task *queue_gettask ( struct queue *q , int rid , int blocking , int keep
ci_best
=
qtasks
[
qtid
[
k
]
].
ci
;
cj_best
=
qtasks
[
qtid
[
k
]
].
cj
;
score_best
=
score
;
hits
+=
1
;
/* Should we bother looking any farther? */
if
(
(
qtasks
[
qtid
[
ind_best
]
].
cj
==
NULL
&&
score_best
==
1
)
||
...
...
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