Create a common function lookup() to search a chan, this eliminates
redundant SC_LOOKUP() calling.
This commit is contained in:
parent
a4392ad6af
commit
fa782a2611
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=235218
@ -94,19 +94,23 @@ _sleepq_unlock(void *wchan)
|
||||
THR_LOCK_RELEASE(curthread, &sc->sc_lock);
|
||||
}
|
||||
|
||||
struct sleepqueue *
|
||||
_sleepq_lookup(void *wchan)
|
||||
static inline struct sleepqueue *
|
||||
lookup(struct sleepqueue_chain *sc, void *wchan)
|
||||
{
|
||||
struct sleepqueue_chain *sc;
|
||||
struct sleepqueue *sq;
|
||||
|
||||
sc = SC_LOOKUP(wchan);
|
||||
LIST_FOREACH(sq, &sc->sc_queues, sq_hash)
|
||||
if (sq->sq_wchan == wchan)
|
||||
return (sq);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
struct sleepqueue *
|
||||
_sleepq_lookup(void *wchan)
|
||||
{
|
||||
return (lookup(SC_LOOKUP(wchan), wchan));
|
||||
}
|
||||
|
||||
void
|
||||
_sleepq_add(void *wchan, struct pthread *td)
|
||||
{
|
||||
@ -114,7 +118,7 @@ _sleepq_add(void *wchan, struct pthread *td)
|
||||
struct sleepqueue *sq;
|
||||
|
||||
sc = SC_LOOKUP(wchan);
|
||||
sq = _sleepq_lookup(wchan);
|
||||
sq = lookup(sc, wchan);
|
||||
if (sq != NULL) {
|
||||
SLIST_INSERT_HEAD(&sq->sq_freeq, td->sleepqueue, sq_flink);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user