1 /*
2  * Copyright 2022 Young Mei
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef TESTS_LIB_THRIFT_THRIFTTEST_SRC_CONTEXT_HPP_
8 #define TESTS_LIB_THRIFT_THRIFTTEST_SRC_CONTEXT_HPP_
9 
10 #include <pthread.h>
11 
12 #include <memory>
13 
14 #include <thrift/server/TSimpleServer.h>
15 
16 #include "ThriftTest.h"
17 
18 using namespace apache::thrift::server;
19 using namespace thrift::test;
20 
21 struct ctx {
22 	enum {
23 		SERVER,
24 		CLIENT,
25 	};
26 
27 	std::array<int, CLIENT + 1> fds;
28 	std::unique_ptr<ThriftTestClient> client;
29 	std::unique_ptr<TServer> server;
30 	pthread_t server_thread;
31 };
32 
33 extern ctx context;
34 
35 #endif /* TESTS_LIB_THRIFT_THRIFTTEST_SRC_CONTEXT_HPP_ */
36