2 * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef SERVER_RUNNER_HH_
18 #define SERVER_RUNNER_HH_
21 #include <glib-unix.h>
25 #include <unordered_map>
27 #include "server_socket.hh"
28 #include "worker_thread.hh"
29 #include "system_locale.hh"
31 namespace pkgmgr_server {
34 #define EXPORT_API __attribute__((visibility("default")))
37 class EXPORT_API Runner
38 : public pkgmgr_common::SystemLocale::IEvent {
40 Runner(unsigned int thread_num);
42 bool QueueRequest(std::shared_ptr<PkgRequest> req);
44 void OnChanged(const std::string& locale) override;
47 static int OnReceiveRequest(int fd, GIOCondition cond, void* user_data);
48 bool QueueRequest(int client_fd);
49 void SetCPUInheritance();
53 unsigned int thread_num_;
54 std::unique_ptr<pkgmgr_common::socket::ServerSocket> server_;
55 std::unique_ptr<WorkerThread> thread_pool_;
58 } // namespace pkgmgr_server
60 #endif // SERVER_RUNNER_HH_