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 B82D270CB5; Mon, 11 Oct 2021 22:17:10 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B82D270CB5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1633979830; bh=Za/4NMMyA2NoZBVsKBz6wrk2ouRxHPgOMH/cnPLKnXs=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=kX3EYH2mPiRX56S2WK4yatqDYAWxu5ipZuoaYw2GDFMBqdQa7DsceLFv6Rt09bT7F bBDgINTukKXlKAugCpdmyyNaxo0i8CHfIDUOxTEMQ72Ab2rGjeNKyxXQmRXFxyIWOK XrxqEkn12vOP7Z8SPgR39zzaC7NONDYbNUWZGixw= Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id F2F9D70CB5 for ; Mon, 11 Oct 2021 22:16:50 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org F2F9D70CB5 Received: by mail-lf1-f50.google.com with SMTP id y15so77755813lfk.7 for ; Mon, 11 Oct 2021 12:16:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WQRXak4ndiQ8ssRvSybhpjPPGpaFF3TXs5ZHDJaf2gU=; b=s7x3hz9v4eH+6jD95SYV2a6CSk5leg0l/6p0TG94xRS6CXy0w+rJteceqhbxxBQamn sbSRwW6Q5N4vTyeMq2CsLXlCgXpIZqq3KgN505AEw2p5gAH0t775K255lGYer65bbYPt tI+C5loaNRR5Kd1Z+QuB8b01YrRk2qMkoVWzwT1dGof5F48vQLxyqPgO2YVKohXRyzXl 2ESjmuZWMslVKmJYyL4+gOv6E1AWREm9slUGDsb3D+oLG+oKr5L1WAuKlgbhIXOzgXbv nH/5tKth0UbAp5JJLB8af/a7KLJKAdA8FYShEM7RWHQsoueQO09PuzDDVHr3r15fSqQL 6ovA== X-Gm-Message-State: AOAM5337u6F0Gk4XgA90YErh6d+BJSDZVG3gawKlg2wfSM0eTDTIwdAd ++7tgOfvy+bzUoP0mxK0Op+qhCg/Fhk= X-Google-Smtp-Source: ABdhPJzRJh7U5END6MOnfECOMOKmzI6eyrkzwHFkeH7NIVADTNgKtoggUtvUaBdrXiupihr5WOGh6w== X-Received: by 2002:a2e:a803:: with SMTP id l3mr24180762ljq.74.1633979809923; Mon, 11 Oct 2021 12:16:49 -0700 (PDT) Received: from grain.localdomain ([5.18.253.97]) by smtp.gmail.com with ESMTPSA id f6sm998791ljo.36.2021.10.11.12.16.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Oct 2021 12:16:49 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id 526315A001F; Mon, 11 Oct 2021 22:16:36 +0300 (MSK) To: tml Date: Mon, 11 Oct 2021 22:16:33 +0300 Message-Id: <20211011191635.573685-2-gorcunov@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211011191635.573685-1-gorcunov@gmail.com> References: <20211011191635.573685-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v22 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: Cyrill Gorcunov via Tarantool-patches Reply-To: Cyrill Gorcunov Cc: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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. -- 2.31.1