From patchwork Mon Nov 29 11:44:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 14837 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 6CA8BBF415 for ; Mon, 29 Nov 2021 11:45:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2A159605B4; Mon, 29 Nov 2021 12:45:06 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="KBc0wTXE"; dkim-atps=neutral Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C7FD660597 for ; Mon, 29 Nov 2021 12:45:03 +0100 (CET) Received: by mail-pl1-x62f.google.com with SMTP id q17so11924120plr.11 for ; Mon, 29 Nov 2021 03:45:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fTPId8aJWvtcDKFDNSLx1VnBGzL59PNNmLExIJt0hrk=; b=KBc0wTXE+eDafmJJvHF0d8BdK8RuHBvP7y0XH/QGR82xG02CgSDpSzvXAg0nN9nBGK T6WVXetG729ZTkKb7rKytEToxIsMI71NHXOgGch6vjJS0u5OkJSn75jEGb8nL0nMAu4p 9X20swRUkoeMALqlfBStZZHYLEx4k9DMwFDHY= 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=fTPId8aJWvtcDKFDNSLx1VnBGzL59PNNmLExIJt0hrk=; b=cixNoVAoUHqlH+5Gu+RtNSFdlT0jQx2JhMol2rHrHiJsQZTkYe9yprj6c+ZRKQ1whv SmevNx8n7J524vrILfUiW/fFWYOPPx9dCC0v9xMC3b68MhrZOeONJwrTybYw+7bdJbnA iqUK2ltX1HdXCkgTGTNBGJyHlZtD9g4ZMWnGixJU4H0wKEWAlqfSRunvlmYfs4a7OlUS BE9m12sh2tNvgMxEg56klQhZvbeFMv730ToacZw3IKpiNEu/FAY3Hvvh4zAxSvhQFWMH OttfpFnxeG6maKLZl1ZEAyQZtyyzVDYiTkg4vApcT3aV2gYpOvlbU1fdVsbbsQGRE5CL iq9Q== X-Gm-Message-State: AOAM530pQ9MBRY6T7m96sdyYd3SXjSak7XHGMwODM8e2LO0xpNgr9+Be 7XEjinny6R4fbYLtu9VNVrPsv2W4dws3JQ== X-Google-Smtp-Source: ABdhPJws6EAbDLiF5qjKSHgbkBSbSvRcMh0n4Lzx4UQlnjIFQWoxaSPXR2FYqwcaFHVeMgwu9M+6Xg== X-Received: by 2002:a17:90b:3b83:: with SMTP id pc3mr37671622pjb.106.1638186301843; Mon, 29 Nov 2021 03:45:01 -0800 (PST) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:f254:cda9:46e8:17b7]) by smtp.gmail.com with ESMTPSA id hg4sm17951966pjb.1.2021.11.29.03.45.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Nov 2021 03:45:01 -0800 (PST) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Mon, 29 Nov 2021 20:44:43 +0900 Message-Id: <20211129114453.3186042-2-hiroh@chromium.org> X-Mailer: git-send-email 2.34.0.rc2.393.gf8c9666880-goog In-Reply-To: <20211129114453.3186042-1-hiroh@chromium.org> References: <20211129114453.3186042-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 01/11] libcamera: base: Introduce ConditionVariable 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" ConditionVariable is alias to std::condition_variable. This replaces std::condition_variable with the ConditionVariable. It enables replacing ConditionVariable implementation easily in the following patches. Signed-off-by: Hirokazu Honda Reviewed-by: Laurent Pinchart --- include/libcamera/base/semaphore.h | 4 +--- include/libcamera/base/thread.h | 2 ++ src/android/camera_stream.h | 3 +-- src/libcamera/base/thread.cpp | 3 +-- src/libcamera/camera_manager.cpp | 3 +-- src/v4l2/v4l2_camera.h | 2 +- 6 files changed, 7 insertions(+), 10 deletions(-) diff --git a/include/libcamera/base/semaphore.h b/include/libcamera/base/semaphore.h index ae87d319..ec05fad3 100644 --- a/include/libcamera/base/semaphore.h +++ b/include/libcamera/base/semaphore.h @@ -7,8 +7,6 @@ #pragma once -#include - #include #include @@ -26,7 +24,7 @@ public: private: Mutex mutex_; - std::condition_variable cv_; + ConditionVariable cv_; unsigned int available_; }; diff --git a/include/libcamera/base/thread.h b/include/libcamera/base/thread.h index 32ebc80a..1ebf8363 100644 --- a/include/libcamera/base/thread.h +++ b/include/libcamera/base/thread.h @@ -7,6 +7,7 @@ #pragma once +#include #include #include #include @@ -26,6 +27,7 @@ class Object; class ThreadData; class ThreadMain; +using ConditionVariable = std::condition_variable; using Mutex = std::mutex; using MutexLocker = std::unique_lock; diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h index e9da75f0..e4808369 100644 --- a/src/android/camera_stream.h +++ b/src/android/camera_stream.h @@ -7,7 +7,6 @@ #pragma once -#include #include #include #include @@ -154,7 +153,7 @@ private: PostProcessor *postProcessor_; libcamera::Mutex mutex_; - std::condition_variable cv_; + libcamera::ConditionVariable cv_; std::queue requests_; State state_ = State::Stopped; diff --git a/src/libcamera/base/thread.cpp b/src/libcamera/base/thread.cpp index d0ca30e3..58e1265f 100644 --- a/src/libcamera/base/thread.cpp +++ b/src/libcamera/base/thread.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include #include @@ -158,7 +157,7 @@ private: std::atomic dispatcher_; - std::condition_variable cv_; + ConditionVariable cv_; std::atomic exit_; int exitCode_; diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index e78bb1d7..77ff3bd1 100644 --- a/src/libcamera/camera_manager.cpp +++ b/src/libcamera/camera_manager.cpp @@ -7,7 +7,6 @@ #include -#include #include #include @@ -63,7 +62,7 @@ private: void createPipelineHandlers(); void cleanup(); - std::condition_variable cv_; + ConditionVariable cv_; bool initialized_; int status_; diff --git a/src/v4l2/v4l2_camera.h b/src/v4l2/v4l2_camera.h index 94263b2f..4afbb331 100644 --- a/src/v4l2/v4l2_camera.h +++ b/src/v4l2/v4l2_camera.h @@ -82,6 +82,6 @@ private: int efd_; libcamera::Mutex bufferMutex_; - std::condition_variable bufferCV_; + libcamera::ConditionVariable bufferCV_; unsigned int bufferAvailableCount_; };