From: Martin Devera Date: Tue, 14 May 2002 12:51:43 +0000 Subject: Re: [LARTC] what's the meaning of xchg()? Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: lartc@vger.kernel.org > I find a line in tbf_change() in sch_tbf.c: ptab = xchg(&q->P_tab, ptab); > > Can I consider that the pointers are exchanged between q->P_tab and ptab? as following: > > prev=q->R_tab; > q->R_tab = rtab; > rtab = prev; > > Is my understanding righ? Yes almost. old = xchg(ptv,v) does old=*ptr; *ptr=v and does it atomicaly (!) thus no locking is needed. devik _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/