From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 2CD1F6EC55; Thu, 15 Jul 2021 14:15:14 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2CD1F6EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1626347714; bh=2G6HECVISyLzb/asELCTqk+bgyAvX0ill4xObMKLoFY=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=eMzUH/FN17m4i73Xyr0jwM4Pwy0x0s8CDwlLpyY0V4PWWPsy7g+L5URjPMYFTA9ut hUhD9Df9rBmMd6lUil2Bijtu7lIKsHkbiNJ9o64GSkryKrZ/pMRicQHlsBENN9L2hp 7eDsFk3813+zD6hKMiZCPFykLZJ+u4Yiewg/VPHE= Received: from smtp50.i.mail.ru (smtp50.i.mail.ru [94.100.177.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 5EAFE6EC55 for ; Thu, 15 Jul 2021 14:15:12 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5EAFE6EC55 Received: by smtp50.i.mail.ru with esmtpa (envelope-from ) id 1m3zKh-0004Fc-Of; Thu, 15 Jul 2021 14:15:12 +0300 To: Cyrill Gorcunov , tml Cc: Vladislav Shpilevoy References: <20210714212328.701280-1-gorcunov@gmail.com> <20210714212328.701280-2-gorcunov@gmail.com> Message-ID: <8e0d7655-6462-7b4e-6d41-d51d09b7c3af@tarantool.org> Date: Thu, 15 Jul 2021 14:15:11 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210714212328.701280-2-gorcunov@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: ru X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD941C43E597735A9C36A98DBA789EBB6AEAF05AC269C48884F182A05F5380850404F5D172BC2A74CEDEE8C0004A25036F268DD91A9723117F8F7C08F5BF61A86FD X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE79EDB57D1FB735487EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006373768BF035B57E5168638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8A637D08FC071CBAF3645243B039F0CF4117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC566404C906FA8ADEA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520140C956E756FBB7AF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B53A69B3AC30C7B9475ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A5F721E3C229FC1240FD149F03D1ED4A44FC4263D81ED7A340D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7501A9DF589746230F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D342B94C1DAF75C4D22F3CE5079A76B811C6164E94C9DBBE90F1C8DD1435E452576A18592CD27DDA5B01D7E09C32AA3244CE39F0252CF48C270D1C4630A9D22D9BE1DD47778AE04E04DFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojSyb42jm8PHJ8UBU6HxoP7Q== X-Mailru-Sender: 3B9A0136629DC9125D61937A2360A4465D39CA16E88D9B1C6F2632FCB2E2A6FDECE7DDE4CAEB0BD9424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [RFC v5 1/5] latch: add latch_is_locked helper X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Serge Petrenko via Tarantool-patches Reply-To: Serge Petrenko Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 15.07.2021 00:23, Cyrill Gorcunov пишет: > To test if latch is locked. > > In-scope-of #6036 > > Signed-off-by: Cyrill Gorcunov Thanks! LGTM. > --- > src/lib/core/latch.h | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/src/lib/core/latch.h b/src/lib/core/latch.h > index 49c59cf63..0aaa8b634 100644 > --- a/src/lib/core/latch.h > +++ b/src/lib/core/latch.h > @@ -95,6 +95,17 @@ latch_owner(struct latch *l) > return l->owner; > } > > +/** > + * Return true if the latch is locked. > + * > + * @param l - latch to be tested. > + */ > +static inline bool > +latch_is_locked(const struct latch *l) > +{ > + return l->owner != NULL; > +} > + > /** > * Lock a latch. If the latch is already locked by another fiber, > * waits for timeout. -- Serge Petrenko