Remove gmainloop support from Mainloop 40/145340/1
authorJaemin Ryu <jm77.ryu@samsung.com>
Tue, 22 Aug 2017 05:51:53 +0000 (14:51 +0900)
committerJaemin Ryu <jm77.ryu@samsung.com>
Tue, 22 Aug 2017 05:51:53 +0000 (14:51 +0900)
Change-Id: I8af6a3b5b0149c6af53f9b7c6b2b639a3aaa8496
Signed-off-by: Jaemin Ryu <jm77.ryu@samsung.com>
include/klay/mainloop.h
include/klay/rmi/service.h
src/mainloop.cpp
src/rmi/service.cpp

index 4b5572901da83528fa463f611e94021dc8834ce0..b06d66bd6ce9296ff2a6d4cfafb7caa6df657cf7 100644 (file)
@@ -41,7 +41,7 @@ public:
        void addEventSource(const int fd, const Event events, Callback&& callback);
        void removeEventSource(const int fd);
        bool dispatch(const int timeout);
-       void run(bool useGMainloop = false);
+       void run();
        void stop();
 
 private:
index a08492c68744208e046f53a02d30296d7c5dafad..83b68beb14ddccbf911a49d93844d2a96a140c5b 100644 (file)
@@ -153,7 +153,7 @@ public:
        Service(const Service&) = delete;
        Service& operator=(const Service&) = delete;
 
-       void start(bool useGMainloop = false);
+       void start();
        void stop();
 
        void setAuditTrail(const AuditTrail& trail);
index aebecd7e9e7d0d261d11a13668dddc7412dfbc27..aea2f69009b4e08787175b7d0160376c1393d57c 100644 (file)
 
 namespace runtime {
 
-namespace {
-
-gboolean GIOCallback(GIOChannel* channel, GIOCondition condition, void *data)
-{
-       Mainloop* mainloop = reinterpret_cast<Mainloop*>(data);
-       mainloop->dispatch(-1);
-       return TRUE;
-}
-
-} // namespace
-
 Mainloop::Mainloop() :
        pollFd(::epoll_create1(EPOLL_CLOEXEC)),
        stopped(false)
@@ -147,27 +136,12 @@ void Mainloop::prepare()
        addEventSource(wakeupSignal.getFd(), EPOLLIN, wakeupMainloop);
 }
 
-void Mainloop::run(bool useGMainloop)
+void Mainloop::run()
 {
        prepare();
 
-       if (useGMainloop) {
-               GIOChannel* channel;
-               channel = g_io_channel_unix_new(pollFd);
-               if (channel == NULL) {
-                       std::cout << "GMAINLOOP CHANNEL ALLOC FAILED" << std::endl;
-                       return;
-               }
-               g_io_add_watch(channel, (GIOCondition)(G_IO_IN|G_IO_HUP), GIOCallback, this);
-               g_io_channel_unref(channel);
-
-               while (!stopped) {
-                       g_main_iteration(TRUE);
-               }
-       } else {
-               while (!stopped) {
-                       dispatch(-1);
-               }
+       while (!stopped) {
+               dispatch(-1);
        }
 }
 
index 8f6e03bc11cd906493d3e54752d0282646bcaefb..c9da900a444ec8fa2baa2cb4a672aeac7720a1c2 100644 (file)
@@ -46,7 +46,7 @@ Service::~Service()
 {
 }
 
-void Service::start(bool useGMainloop)
+void Service::start()
 {
        Socket socket(Socket::create(address));
 
@@ -58,7 +58,7 @@ void Service::start(bool useGMainloop)
                                                        EPOLLIN | EPOLLHUP | EPOLLRDHUP,
                                                        accept);
 
-       mainloop.run(useGMainloop);
+       mainloop.run();
 }
 
 void Service::stop()