summaryrefslogtreecommitdiff
path: root/src/android/thread_rpc.h
blob: f577a5d9fb32d993eeb21a9b27d25b0392011f00 (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
34
35
36
37
38
39
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2019, Google Inc.
 *
 * thread_rpc.h - Inter-thread procedure call
 */
#ifndef __ANDROID_THREAD_RPC_H__
#define __ANDROID_THREAD_RPC_H__

#include <condition_variable>
#include <mutex>

#include <hardware/camera3.h>

class ThreadRpc
{
public:
	enum RpcTag {
		ProcessCaptureRequest,
		Close,
	};

	ThreadRpc()
		: delivered_(false) {}

	void notifyReception();
	void waitDelivery();

	RpcTag tag;

	camera3_capture_request_t *request;

private:
	bool delivered_;
	std::mutex mutex_;
	std::condition_variable cv_;
};

#endif /* __ANDROID_THREAD_RPC_H__ */