From patchwork Wed Apr 27 14:51:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Curtin X-Patchwork-Id: 15733 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 6F587C3256 for ; Wed, 27 Apr 2022 14:52:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B765865644; Wed, 27 Apr 2022 16:52:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1651071126; bh=LAEZO0dKJPnAyTjHsGcBpa2Cl4czd6wQFDOFxrkY1Gc=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=sbmfhq1dx3eh0aaImAfgDIxLo/8GbZ1ZYoAUkCAtxe+WHd0ACQqokUD7myPaa+Hvn JZTX5nelWR0y4teLjfpvKh1fGGtR1YSnOsUr4RDYwFrp1Na+qYRpuKTb3y3f22e47h 7TtANsemumy1FiLhSIRsyDFmAoX0kZCdo7spTFuOgOi+QlnBL0cgyGrU/N7dA7KHc5 hf17bxgUciT79zqQpzFCGXbtKGzlksYxV2AMdfPfFqnbScA4kP4abYYRcCiVlZeojg fu8wdU9FJhwUrMxiYIkOYsHTEnjl3QUrunFCoLrImDPaDjGK0H0siKZp8JIu+qhgBh 8fszzYf888Qng== Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 03CE46042F for ; Wed, 27 Apr 2022 16:52:04 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="FXnH76D0"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651071123; 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=FXnH76D0OAyVYZQLDuBZR4Y0hpbXO/MR2QWGkZeY5GAV+Pj1ipTcGYYWQkSYooQ33lI7lk 5yJXTQUd0jZtJaUtzaN3dTFfaLWfpmL8rbMYAu525S/GePLmG8o0cGNex4X7iF3kQCfJAW zKhuUaycaSwPU1Fx4Q2Z3amHbSUACV0= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-357-SfDrhK4sPZKdJLM1-mP9rw-1; Wed, 27 Apr 2022 10:52:02 -0400 X-MC-Unique: SfDrhK4sPZKdJLM1-mP9rw-1 Received: by mail-wm1-f72.google.com with SMTP id q188-20020a1c43c5000000b003928f679c42so836740wma.5 for ; Wed, 27 Apr 2022 07:52:01 -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=xCXf/+S6uygfUkAxaDUhFIUcZFJ+WXQRh7OcnUc82LPcUldz+L/fycPNqI0KM4ti6r 212GZMFlFvOmjfhCdq+eNZOIOSOw5Lx7iRY3jnerObqfEZJ0c53dy9bFPAn0wfgAz4HI ToaI3bifjSuFG7PeUKdTM7VKxGt9en+Fj9sGdvoZPX9xRkon5USJs+wGCIfGZr9mrx41 w5mA+GukbMb+m+mO5c34Liraf0GoZ0Kj803gOcs7jH5+7gR/iMox+mgEVm0VD5tUj0F3 kR1nxjirKXpVBameE413x7Xss26kCkxKhwNomEv/QMaNxKB+h8gk9zGpvXEZV4KtmGLX 9+uw== X-Gm-Message-State: AOAM532nsvUrxYjV3yTSM1atTWAYqWZkfu56UtIoLeuLtdr2jmcMBclz m0aT1X03MSSmKWrY+TCgh827B5PxNh+gVwc4ULH/ZeinKQu+zPY8tU9oAHZXA0ZYcy48MCeMbxv L4614aakI3WRYCqom+0MZ41YG/juoz06mqzyP1H11P+zQ+AuHz3Auv7Zv7pc7WzN4M9ZIj6Gm4v +0s6P+BQXz X-Received: by 2002:a05:600c:2f0f:b0:393:fbd1:cc94 with SMTP id r15-20020a05600c2f0f00b00393fbd1cc94mr6761028wmn.162.1651071120567; Wed, 27 Apr 2022 07:52:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+brjsiqgzmAohThmiXm6RiNEh03urpLOVTdjulSWdqa2jLoDSalylcLyOc4ncBdQNPx+DXg== X-Received: by 2002:a05:600c:2f0f:b0:393:fbd1:cc94 with SMTP id r15-20020a05600c2f0f00b00393fbd1cc94mr6761012wmn.162.1651071120310; Wed, 27 Apr 2022 07:52:00 -0700 (PDT) Received: from localhost.localdomain ([2001:bb6:9634:7100:33b0:c1b1:8875:4adb]) by smtp.gmail.com with ESMTPSA id h9-20020a05600c350900b00393f01c8f00sm1788811wmq.47.2022.04.27.07.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 07:51:59 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 27 Apr 2022 15:51:50 +0100 Message-Id: <20220427145150.4710-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) { }