From 4e85f82250b3b6f8f3d90d97b30425b7be3b9993 Mon Sep 17 00:00:00 2001 From: Roland Jax Date: Wed, 7 Jan 2015 23:12:39 +0100 Subject: [PATCH] class notify reduced too single file. --- src/lib/utils/Makefile.am | 6 ++---- src/lib/utils/notify.cpp | 42 --------------------------------------- src/lib/utils/notify.h | 15 ++++++++++++-- 3 files changed, 15 insertions(+), 48 deletions(-) delete mode 100644 src/lib/utils/notify.cpp diff --git a/src/lib/utils/Makefile.am b/src/lib/utils/Makefile.am index 3f9640ac..7190b20c 100644 --- a/src/lib/utils/Makefile.am +++ b/src/lib/utils/Makefile.am @@ -10,14 +10,12 @@ libutils_a_SOURCES = appl.cpp \ daemon.h \ logger.cpp \ logger.h \ - notify.cpp \ - notify.h \ tcpsocket.cpp \ tcpsocket.h \ thread.cpp \ thread.h \ - wqueue.h - + wqueue.h \ + notify.h distclean-local: -rm -f Makefile.in diff --git a/src/lib/utils/notify.cpp b/src/lib/utils/notify.cpp deleted file mode 100644 index d9416162..00000000 --- a/src/lib/utils/notify.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) Roland Jax 2012-2014 - * - * This file is part of ebusd. - * - * ebusd is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ebusd is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ebusd. If not, see http://www.gnu.org/licenses/. - */ - -#include "notify.h" - -Notify::Notify() -{ - int pipefd[2]; - int ret = pipe(pipefd); - - if (ret == 0) { - m_recvfd = pipefd[0]; - m_sendfd = pipefd[1]; - - fcntl(m_sendfd, F_SETFL, O_NONBLOCK); - } - -} - -Notify::~Notify() -{ - close(m_sendfd); - close(m_recvfd); -} - - diff --git a/src/lib/utils/notify.h b/src/lib/utils/notify.h index 26693308..f5d0ed06 100644 --- a/src/lib/utils/notify.h +++ b/src/lib/utils/notify.h @@ -35,12 +35,23 @@ public: /** * @brief constructs a new instance and do notifying. */ - Notify(); + Notify() + { + int pipefd[2]; + int ret = pipe(pipefd); + + if (ret == 0) { + m_recvfd = pipefd[0]; + m_sendfd = pipefd[1]; + + fcntl(m_sendfd, F_SETFL, O_NONBLOCK); + } + } /** * @brief destructor. */ - ~Notify(); + ~Notify() { close(m_sendfd); close(m_recvfd); } /** * @brief file descriptor to watch for notify event.