[{"id":2984,"web_url":"https://patchwork.libcamera.org/comment/2984/","msgid":"<20191029143847.GJ20198@bigcity.dyn.berto.se>","date":"2019-10-29T14:38:47","subject":"Re: [libcamera-devel] [PATCH v2 2/9] libcamera: bound_method:\n\tDefine connection type for method invocation","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2019-10-28 12:49:06 +0200, Laurent Pinchart wrote:\n> From: Jacopo Mondi <jacopo@jmondi.org>\n> \n> Define an enumeration of connection types to describe the delivery\n> method of signals and method invocation.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  Documentation/Doxyfile.in        |  4 +---\n>  include/libcamera/bound_method.h |  7 +++++++\n>  src/libcamera/bound_method.cpp   | 34 ++++++++++++++++++++++++++++++++\n>  3 files changed, 42 insertions(+), 3 deletions(-)\n> \n> diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in\n> index 5237cf60854f..24babfd8b366 100644\n> --- a/Documentation/Doxyfile.in\n> +++ b/Documentation/Doxyfile.in\n> @@ -837,9 +837,7 @@ RECURSIVE              = YES\n>  # Note that relative paths are relative to the directory from which doxygen is\n>  # run.\n>  \n> -EXCLUDE                = @TOP_SRCDIR@/include/libcamera/bound_method.h \\\n> -\t\t\t @TOP_SRCDIR@/src/libcamera/bound_method.cpp \\\n> -\t\t\t @TOP_SRCDIR@/src/libcamera/device_enumerator_sysfs.cpp \\\n> +EXCLUDE                = @TOP_SRCDIR@/src/libcamera/device_enumerator_sysfs.cpp \\\n>  \t\t\t @TOP_SRCDIR@/src/libcamera/device_enumerator_udev.cpp \\\n>  \t\t\t @TOP_SRCDIR@/src/libcamera/include/device_enumerator_sysfs.h \\\n>  \t\t\t @TOP_SRCDIR@/src/libcamera/include/device_enumerator_udev.h \\\n> diff --git a/include/libcamera/bound_method.h b/include/libcamera/bound_method.h\n> index 8ebaadbec887..e1524c917e4b 100644\n> --- a/include/libcamera/bound_method.h\n> +++ b/include/libcamera/bound_method.h\n> @@ -14,6 +14,13 @@ namespace libcamera {\n>  \n>  class Object;\n>  \n> +enum ConnectionType {\n> +\tConnectionTypeAuto,\n> +\tConnectionTypeDirect,\n> +\tConnectionTypeQueued,\n> +\tConnectionTypeBlocking,\n> +};\n> +\n>  class BoundMethodBase\n>  {\n>  public:\n> diff --git a/src/libcamera/bound_method.cpp b/src/libcamera/bound_method.cpp\n> index d89f84c03f4d..ab6ecd9423d1 100644\n> --- a/src/libcamera/bound_method.cpp\n> +++ b/src/libcamera/bound_method.cpp\n> @@ -11,8 +11,42 @@\n>  #include \"thread.h\"\n>  #include \"utils.h\"\n>  \n> +/**\n> + * \\file bound_method.h\n> + * \\brief Method bind and invocation\n> + */\n> +\n>  namespace libcamera {\n>  \n> +/**\n> + * \\enum ConnectionType\n> + * \\brief Connection type for asynchronous communication\n> + *\n> + * This enumeration describes the possible types of asynchronous communication\n> + * between a sender and a receiver. It applies to Signal::emit() and\n> + * Object::invokeMethod().\n> + *\n> + * \\var ConnectionType::ConnectionTypeAuto\n> + * \\brief If the sender and the receiver live in the same thread,\n> + * ConnectionTypeDirect is used. Otherwise ConnectionTypeQueued is used.\n> + *\n> + * \\var ConnectionType::ConnectionTypeDirect\n> + * \\brief The receiver is invoked immediately and synchronously in the sender's\n> + * thread.\n> + *\n> + * \\var ConnectionType::ConnectionTypeQueued\n> + * \\brief The receiver is invoked asynchronously in its thread when control\n> + * returns to the thread's event loop. The sender proceeds without waiting for\n> + * the invocation to complete.\n> + *\n> + * \\var ConnectionType::ConnectionTypeBlocking\n> + * \\brief The receiver is invoked asynchronously in its thread when control\n> + * returns to the thread's event loop. The sender blocks until the receiver\n> + * signals the completion of the invocation. This connection type shall not be\n> + * used when the sender and receiver live in the same thread, otherwise\n> + * deadlock will occur.\n> + */\n> +\n>  void BoundMethodBase::activatePack(void *pack)\n>  {\n>  \tif (Thread::current() == object_->thread()) {\n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x244.google.com (mail-lj1-x244.google.com\n\t[IPv6:2a00:1450:4864:20::244])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B6C286017E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 29 Oct 2019 15:38:49 +0100 (CET)","by mail-lj1-x244.google.com with SMTP id m9so5879251ljh.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 29 Oct 2019 07:38:49 -0700 (PDT)","from localhost (h-93-159.A463.priv.bahnhof.se. [46.59.93.159])\n\tby smtp.gmail.com with ESMTPSA id\n\tb2sm10131190lfq.27.2019.10.29.07.38.48\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 29 Oct 2019 07:38:48 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=IsA0Mv/BmP0Ezc+H3zqnOIh8GHfTjpXFsNQY2qFPtvc=;\n\tb=V6jDwalA1qhSMEM6xkXzIDTM38pxpGzUgNcHn2NVZdHqGqylcqzp/fVnuwAQttsn57\n\t8i5JeLD5R8Ut/GA2p4FJdP/TL2l/tWKLUUHfV8pfsYmaJLt71ijCHE3STEDGWvUQD2tS\n\tHvJlTGhiB39Pu6wE5XLVrwprWabApfyoEwm5t2/8XvwBcu62IcaJJcbDH883H9+shpcM\n\tI77Fwy/A4l8StMfCHdt4ymfuDnUu6A9WuTvhvVHtLXbAhFjRJAb9GBrEHdINKoHvX0yC\n\tRr3J7HTjA37GBGopVBP+vyNY6wgFeuuYI6KdDRH59lE3oOUGT7tmbylDDjpfHoBXNVE9\n\tWE4Q==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=IsA0Mv/BmP0Ezc+H3zqnOIh8GHfTjpXFsNQY2qFPtvc=;\n\tb=kx4ZoFh9E9eXEWoRAuX+4IJO60rsi0H/kes5l1xQJMa3MhvyIRiBhxQGZKrWe2D/tr\n\tJxOKiXiZ+HCDzY1GmT2gjBcdlOe6A16NVFfYOs4waIPOqVjXkK2hNEZWem9lgo9XPqTn\n\tfiuKCygKBjYDGv1eP2GjGD9R0YUq4qKX5dyFLALPiKiYEYQEIKCSpLTSxRIj3F1sWnDz\n\t2w76gNF4eRBiq08ZPht67IFaRT+yjEshO9Tv+oSwS17kvpsOFJiry7TGZTu8gFgVhg0J\n\t27+zPuaxUoM0FG7X+1G5kjkXDS8BE7bO/w2I93C4M7Uhw0pn3qCIZAKiewLjDJzUNI6/\n\tAayg==","X-Gm-Message-State":"APjAAAUM6oEQmdyEIjwhCaIPk3lv/c5+WX/+VhpyUOISIB6kmuKGA4tL\n\tHeA0it//x4IdvVt69/yUujcbog==","X-Google-Smtp-Source":"APXvYqwVxXzomC8XvQyL0IFEpKY2+lFJj3Cwn5MzRyhyRHMa9VKKGm9XZX5MtJgB4BFHfxLvxSiuNg==","X-Received":"by 2002:a05:651c:ce:: with SMTP id\n\t14mr3012461ljr.23.1572359928970; \n\tTue, 29 Oct 2019 07:38:48 -0700 (PDT)","Date":"Tue, 29 Oct 2019 15:38:47 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20191029143847.GJ20198@bigcity.dyn.berto.se>","References":"<20191028104913.14985-1-laurent.pinchart@ideasonboard.com>\n\t<20191028104913.14985-3-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20191028104913.14985-3-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.12.1 (2019-06-15)","Subject":"Re: [libcamera-devel] [PATCH v2 2/9] libcamera: bound_method:\n\tDefine connection type for method invocation","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Tue, 29 Oct 2019 14:38:49 -0000"}}]