summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2019-10-27 02:28:40 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-10-29 16:41:33 +0200
commit1e2db0eee7b3752507de50788c974e40dcafaf1b (patch)
treed34a2387d7ff32b5155e673635c2a70bd8f73bb8
parent66e7c5b774e288faa3a9b413861d6a77723db3ad (diff)
libcamera: bound_method: Define connection type for method invocation
Define an enumeration of connection types to describe the delivery method of signals and method invocation. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
-rw-r--r--Documentation/Doxyfile.in4
-rw-r--r--include/libcamera/bound_method.h7
-rw-r--r--src/libcamera/bound_method.cpp34
3 files changed, 42 insertions, 3 deletions
diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in
index 5237cf60..24babfd8 100644
--- a/Documentation/Doxyfile.in
+++ b/Documentation/Doxyfile.in
@@ -837,9 +837,7 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is
# run.
-EXCLUDE = @TOP_SRCDIR@/include/libcamera/bound_method.h \
- @TOP_SRCDIR@/src/libcamera/bound_method.cpp \
- @TOP_SRCDIR@/src/libcamera/device_enumerator_sysfs.cpp \
+EXCLUDE = @TOP_SRCDIR@/src/libcamera/device_enumerator_sysfs.cpp \
@TOP_SRCDIR@/src/libcamera/device_enumerator_udev.cpp \
@TOP_SRCDIR@/src/libcamera/include/device_enumerator_sysfs.h \
@TOP_SRCDIR@/src/libcamera/include/device_enumerator_udev.h \
diff --git a/include/libcamera/bound_method.h b/include/libcamera/bound_method.h
index 8ebaadbe..e1524c91 100644
--- a/include/libcamera/bound_method.h
+++ b/include/libcamera/bound_method.h
@@ -14,6 +14,13 @@ namespace libcamera {
class Object;
+enum ConnectionType {
+ ConnectionTypeAuto,
+ ConnectionTypeDirect,
+ ConnectionTypeQueued,
+ ConnectionTypeBlocking,
+};
+
class BoundMethodBase
{
public:
diff --git a/src/libcamera/bound_method.cpp b/src/libcamera/bound_method.cpp
index d89f84c0..ab6ecd94 100644
--- a/src/libcamera/bound_method.cpp
+++ b/src/libcamera/bound_method.cpp
@@ -11,8 +11,42 @@
#include "thread.h"
#include "utils.h"
+/**
+ * \file bound_method.h
+ * \brief Method bind and invocation
+ */
+
namespace libcamera {
+/**
+ * \enum ConnectionType
+ * \brief Connection type for asynchronous communication
+ *
+ * This enumeration describes the possible types of asynchronous communication
+ * between a sender and a receiver. It applies to Signal::emit() and
+ * Object::invokeMethod().
+ *
+ * \var ConnectionType::ConnectionTypeAuto
+ * \brief If the sender and the receiver live in the same thread,
+ * ConnectionTypeDirect is used. Otherwise ConnectionTypeQueued is used.
+ *
+ * \var ConnectionType::ConnectionTypeDirect
+ * \brief The receiver is invoked immediately and synchronously in the sender's
+ * thread.
+ *
+ * \var ConnectionType::ConnectionTypeQueued
+ * \brief The receiver is invoked asynchronously in its thread when control
+ * returns to the thread's event loop. The sender proceeds without waiting for
+ * the invocation to complete.
+ *
+ * \var ConnectionType::ConnectionTypeBlocking
+ * \brief The receiver is invoked asynchronously in its thread when control
+ * returns to the thread's event loop. The sender blocks until the receiver
+ * signals the completion of the invocation. This connection type shall not be
+ * used when the sender and receiver live in the same thread, otherwise
+ * deadlock will occur.
+ */
+
void BoundMethodBase::activatePack(void *pack)
{
if (Thread::current() == object_->thread()) {