From patchwork Wed Apr 27 15:26:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Curtin X-Patchwork-Id: 15736 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id A25D3C3256 for ; Wed, 27 Apr 2022 15:26:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1036365644; Wed, 27 Apr 2022 17:26:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1651073216; bh=LAEZO0dKJPnAyTjHsGcBpa2Cl4czd6wQFDOFxrkY1Gc=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=kthit8Vs4w0fTLyNL3R5i/B7OkTrKVq21aFON6SBhzb4b6gMp1Pl5nq5YTKdsQi3l WXBO6Ll3PpaHDoUrepnernXN6RqJh8AmS+0ZuKj96MKY7cHB9KWVUJBEI2Vk2Qx/h3 rHNuhSilNJ8uvfeDwaRpSuS4/4asBs1mKIK6B6mW1SHiiNBvcwFp3jwsu00a7XNKAb AarAiIriE1xnCPpJVaxi8megumAU8qldcrIg59XVXxwM/TxYN/ouKHDFofwKLjd+3F IEuKhPBDDI96/PwDp5PNUqNDr3Lh8fF2bWxkGG8qStYvzSl2B3MuEFB0c22wC0+NJq IKO3/YwJzVGiQ== Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AE9AC6042F for ; Wed, 27 Apr 2022 17:26:54 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="DE3yqGI9"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651073213; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3WIJXXPY8QbYrl/Cd9IRy29MzVEf0rqTXCyvCILt5NE=; b=DE3yqGI9zzFnDa1ssY91F/pQOPqZjqyC0EWM57ceIU/YubgyNTO8qboC52ZjU//DBXDbRT p1n7HVgadeEdwGOM1GQxy4mO9+3xSDl2MV6O60yU+EuVAr57eIAsBY2yqQICcRCbWRJBcE dSsDVyIj4JaujowfBB86gINzlocmgmc= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-50-X101-Vm7PMqy4p3bKjg6YQ-1; Wed, 27 Apr 2022 11:26:52 -0400 X-MC-Unique: X101-Vm7PMqy4p3bKjg6YQ-1 Received: by mail-wr1-f70.google.com with SMTP id t17-20020adfa2d1000000b0020ac519c222so879830wra.4 for ; Wed, 27 Apr 2022 08:26:51 -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:mime-version :content-transfer-encoding; bh=3WIJXXPY8QbYrl/Cd9IRy29MzVEf0rqTXCyvCILt5NE=; b=xDq1P1EAKSYLi6Jt8DEBqsE/KiygTvlPjFumFdMdWY+UZ3yuDeaP32NZZkX5T7Yr5t TOYbcYu5SS3b0xNkBqTzDabgns6UtDj4ucwXwJbQ+jcvRlUCbCSuYJB+Ppy9JW+3XLQB TR2US3jWC0HqcuWmCd8IEg6rMKrXedd5T2krITvTaV5e7kafYlcpzMF7d7cp1TcDrcMr t72fRYEro2nTotmnm7eWsstEECwuKr7jV+DdV04UWp/ZMD6imVxghGFdcYvLbk0+5wE8 gvNg+liJxX3/KYg5pPG7v+ED+Cis0QE4zjF3rRhzGkDz+zUZAGJ2NYpa4DpRrjTPVMHO z6+w== X-Gm-Message-State: AOAM531ycvbNaD/Xi7qr6KHX9kC/FGuIpi8+2ePjZ2y+hUpNHdwHlm+X ZOIY2vcvyCnLNnm8xa7dyisdL+rCCLrQcfWadyFG6zAZM070CRdviRWZ3NVWE0fhBxkdCuHG0sd GennY0iF2SZiePsIn7z/WDPSdZOz30pIQZQq5enGwMpdC+3vzhx/MnfDAvRv1X+acaTSYj6BMr0 oYzn02rfAk X-Received: by 2002:adf:e60a:0:b0:20a:c402:6810 with SMTP id p10-20020adfe60a000000b0020ac4026810mr23484529wrm.45.1651073210477; Wed, 27 Apr 2022 08:26:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvkyxP2aIzkdDK1OFcGVfg8ediCMubQg4jQQwN88M0oR3T7sJMh4IMyP27DI8SnuVvLPTotQ== X-Received: by 2002:adf:e60a:0:b0:20a:c402:6810 with SMTP id p10-20020adfe60a000000b0020ac4026810mr23484511wrm.45.1651073210187; Wed, 27 Apr 2022 08:26:50 -0700 (PDT) Received: from localhost.localdomain ([2001:bb6:9634:7100:33b0:c1b1:8875:4adb]) by smtp.gmail.com with ESMTPSA id e30-20020adf9bde000000b0020aeafa418dsm2600034wrc.14.2022.04.27.08.26.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 08:26:49 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 27 Apr 2022 16:26:40 +0100 Message-Id: <20220427152640.2192-1-ecurtin@redhat.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ecurtin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [libcamera-devel] [PATCH] libcamera: base: Make MutexLocker(Mutex &mutex) non-blocking X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Eric Curtin via libcamera-devel From: Eric Curtin Reply-To: Eric Curtin Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Camera::acquire claims to be non-blocking, in order to achieve this, std::unique_lock constructor must be called with try_to_lock so it doesn't block if a lock cannot be obtained. Bug: https://bugs.libcamera.org/show_bug.cgi?id=127 Signed-off-by: Eric Curtin --- include/libcamera/base/mutex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/libcamera/base/mutex.h b/include/libcamera/base/mutex.h index 2d23e49e..c4a5f791 100644 --- a/include/libcamera/base/mutex.h +++ b/include/libcamera/base/mutex.h @@ -45,7 +45,7 @@ class LIBCAMERA_TSA_SCOPED_CAPABILITY MutexLocker final { public: explicit MutexLocker(Mutex &mutex) LIBCAMERA_TSA_ACQUIRE(mutex) - : lock_(mutex.mutex_) + : lock_(mutex.mutex_, std::try_to_lock) { }