示例#1
0
文件: locktdeq.c 项目: a1406/setting
struct cds_list_head *pdeq_pop_l(struct pdeq *d)
{
	struct cds_list_head *e;

	spin_lock(&d->llock);
	e = deq_pop_l(&d->ldeq);
	if (e == NULL) {
		spin_lock(&d->rlock);
		e = deq_pop_l(&d->rdeq);
		cds_list_splice(&d->rdeq.chain, &d->ldeq.chain);
		CDS_INIT_LIST_HEAD(&d->rdeq.chain);
		spin_unlock(&d->rlock);
	}
	spin_unlock(&d->llock);
	return e;
}
示例#2
0
//\begin{snippet}[labelbase=ln:SMPdesign:locktdeq:pop_push,commandchars=\\\@\$]
struct cds_list_head *pdeq_pop_l(struct pdeq *d)		//\lnlbl{popl:b}
{
	struct cds_list_head *e;

	spin_lock(&d->llock);					//\lnlbl{popl:acq:l}
	e = deq_pop_l(&d->ldeq);				//\lnlbl{popl:deq:ll}
	if (e == NULL) {
		spin_lock(&d->rlock);				//\lnlbl{popl:acq:r}
		e = deq_pop_l(&d->rdeq);			//\lnlbl{popl:deq:lr}
		cds_list_splice(&d->rdeq.chain, &d->ldeq.chain);//\lnlbl{popl:move}
		CDS_INIT_LIST_HEAD(&d->rdeq.chain);		//\lnlbl{popl:init:r}
		spin_unlock(&d->rlock);				//\lnlbl{popl:rel:r}
	}							//\lnlbl{popl:skip}
	spin_unlock(&d->llock);					//\lnlbl{popl:rel:l}
	return e;
}								//\lnlbl{popl:e}
示例#3
0
struct cds_list_head *pdeq_pop_l(struct pdeq *d)
{
	struct cds_list_head *e;
	int i;

	spin_lock(&d->llock);
	i = moveright(d->lidx);
	e = deq_pop_l(&d->bkt[i]);
	if (e != NULL)
		d->lidx = i;
	spin_unlock(&d->llock);
	return e;
}