From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 10E9330D27 for ; Wed, 19 Jun 2019 17:23:21 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aNmpB7i9sY3R for ; Wed, 19 Jun 2019 17:23:20 -0400 (EDT) Received: from smtp63.i.mail.ru (smtp63.i.mail.ru [217.69.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 53D9E30CE5 for ; Wed, 19 Jun 2019 17:23:20 -0400 (EDT) From: Georgy Kirichenko Subject: [tarantool-patches] [PATCH v4 2/9] core: latch_steal routine Date: Thu, 20 Jun 2019 00:23:09 +0300 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org Cc: Georgy Kirichenko 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(); +} + /** * \copydoc box_latch_unlock */ -- 2.22.0