summaryrefslogtreecommitdiff
path: root/src/libcamera/bound_method.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcamera/bound_method.cpp')
-rw-r--r--src/libcamera/bound_method.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/libcamera/bound_method.cpp b/src/libcamera/bound_method.cpp
new file mode 100644
index 00000000..0a2d61a6
--- /dev/null
+++ b/src/libcamera/bound_method.cpp
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/*
+ * Copyright (C) 2019, Google Inc.
+ *
+ * bound_method.cpp - Method bind and invocation
+ */
+
+#include <libcamera/bound_method.h>
+
+#include "message.h"
+#include "thread.h"
+#include "utils.h"
+
+namespace libcamera {
+
+void BoundMethodBase::disconnect(SignalBase *signal)
+{
+ if (object_)
+ object_->disconnect(signal);
+}
+
+void BoundMethodBase::activatePack(void *pack)
+{
+ if (Thread::current() == object_->thread()) {
+ invokePack(pack);
+ } else {
+ std::unique_ptr<Message> msg =
+ utils::make_unique<SignalMessage>(this, pack);
+ object_->postMessage(std::move(msg));
+ }
+}
+
+} /* namespace libcamera */