[tarantool-patches] [PATCH v4 2/9] core: latch_steal routine

Георгий Кириченко georgy at tarantool.org
Thu Jun 20 23:34:22 MSK 2019


On Thursday, June 20, 2019 2:53:11 PM MSK Vladimir Davydov wrote:
> On Thu, Jun 20, 2019 at 12:23:09AM +0300, Georgy Kirichenko wrote:
> > Allow to steal locked latch ownership for fiber which isn't owner
> > of the latch. This is required to process transaction triggers
> > asynchronously.
> > 
> > Prerequisites: #1254
> > ---
> > 
> >  src/lib/core/latch.h | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/src/lib/core/latch.h b/src/lib/core/latch.h
> > index 49c59cf63..580942564 100644
> > --- a/src/lib/core/latch.h
> > +++ b/src/lib/core/latch.h
> > @@ -155,6 +155,16 @@ latch_trylock(struct latch *l)
> > 
> >  	return latch_lock_timeout(l, 0);
> >  
> >  }
> > 
> > +/**
> > + * Take a latch ownership
> > + */
> > +static inline void
> > +latch_steal(struct latch *l)
> > +{
> > +	assert(l->owner != NULL);
> > +	l->owner = fiber();
> > +}
> > +
> 
> Please try not to introduce dead code. This patch should be squashed
> into the one that actually uses latch_steal IMO.
Ack
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20190620/36fd192e/attachment.sig>


More information about the Tarantool-patches mailing list