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 5E6786E454; Mon, 28 Feb 2022 11:13:40 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5E6786E454 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1646036020; bh=gNtms1A/17cnkY8haJ3e4n4HaujHtU/PY/aWCb33rB4=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=btTWjWsJEsceqAY2MM2IYZbaqt4Eqfj5ONPzizwUZC9G6HNzqu0HUeIxDZ1OZ3XbX 0OFQuiK6AcLh52lvODxZTRTsRAdyVSpy/gfVHZ8fTn3CDifUwYMB2S6vALOJpJYUJ4 exObPxILNsAo6B1ifr1D0icifC3owt9z+1dXikbc= Received: from smtp41.i.mail.ru (smtp41.i.mail.ru [94.100.177.101]) (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 E74AF6E454 for ; Mon, 28 Feb 2022 11:13:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E74AF6E454 Received: by smtp41.i.mail.ru with esmtpa (envelope-from ) id 1nOb9u-0004y8-59; Mon, 28 Feb 2022 11:13:30 +0300 Message-ID: Date: Mon, 28 Feb 2022 11:13:29 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: ru To: Cyrill Gorcunov , tml References: <20220224201841.412565-1-gorcunov@gmail.com> <20220224201841.412565-2-gorcunov@gmail.com> In-Reply-To: <20220224201841.412565-2-gorcunov@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-4EC0790: 10 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD95E12778296193B1F8340FF821E0E31D8213A1E3041D1DA5600894C459B0CD1B9490BC95EF02D765E270BAC8F9BD57260C299CA69C3846B72611C1030484FBD82 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7196003627DEC9496EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637040380BD28C1B15C8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D83085961C85467F4F9F9B25E6914D1631117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCEA77C8EAE1CE44B0A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352026055571C92BF10F28451B159A507268D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EEC8105B04EFE076284782AAF36435267CD8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE34E7D9683544204AF2D242C3BD2E3F4C6C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F79006370DBF8AFB6532378BEFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-8FC586DF: 6EFBBC1D9D64D975 X-C1DE0DAB: 0D63561A33F958A5B59CB359ED3914BD0EBEB6193263CFA5F38E33242758899DD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75F78D6440C3F49C15410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D345DB600F8E858000FE5FE6E876850B9697F4EA903F2F49EEE17429A28352AB58BB4CF9D810C52017E1D7E09C32AA3244CC80AB7B6BFFB77F9E3553938980A646E5595C85A795C7BAE927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojNOYcSwubUYKLm5rYPTbi8w== X-Mailru-Sender: 11C2EC085EDE56FA38FD4C59F7EFE407D27D24C7C1AF22B233B23AC396F22C105ED86B33B69BEDFA6BB2E709EA627F343C7DDD459B58856F0E45BC603594F5A135B915D4279FF0574198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v30 1/3] 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 Cc: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 24.02.2022 23:18, Cyrill Gorcunov пишет: > To test if latch is locked. > > Part-of #6036 > > Signed-off-by: Cyrill Gorcunov > --- > 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. Thanks! LGTM. -- Serge Petrenko