static const std::string SOCK_PATH = "/run/pkgmgr-info-server";
-Runner::Runner(int thread_num) : thread_num_(thread_num) {
+Runner::Runner(int thread_num) : sid_(-1), thread_num_(thread_num) {
server_ = std::make_unique<pkgmgr_common::socket::ServerSocket>(SOCK_PATH);
thread_pool_ = std::make_unique<WorkerThread>(thread_num_);
- g_unix_fd_add(server_->GetFd(), G_IO_IN, OnReceiveRequest, this);
+ sid_ = g_unix_fd_add(server_->GetFd(), G_IO_IN, OnReceiveRequest, this);
vconf_notify_key_changed(VCONFKEY_LANGSET, OnLanguageChange, this);
thread_pool_->SetLocale(vconf_get_str(VCONFKEY_LANGSET));
LOGI("Start Runner");
}
+Runner::~Runner() {
+ g_source_remove(sid_);
+ vconf_ignore_key_changed(VCONFKEY_LANGSET, OnLanguageChange);
+}
+
int Runner::OnReceiveRequest(int fd, GIOCondition cond, void* user_data) {
auto runner = static_cast<Runner*>(user_data);
int client_fd = runner->server_->Accept();
class EXPORT_API Runner {
public:
Runner(int thread_num);
- ~Runner() = default;
+ ~Runner();
private:
static int OnReceiveRequest(int fd, GIOCondition cond, void* user_data);
bool QueueRequest(int client_fd);
private:
+ int sid_;
int thread_num_;
std::unique_ptr<pkgmgr_common::socket::ServerSocket> server_;
std::unique_ptr<WorkerThread> thread_pool_;