summaryrefslogtreecommitdiff
path: root/src/libcamera/bound_method.cpp
blob: 0a2d61a6c805820f051f09a8543efd2a33cd5d36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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 */