Buteo Synchronization Framework
SyncSigHandler.h
1/*
2 * This file is part of buteo-syncfw package
3 *
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5 *
6 * Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * version 2.1 as published by the Free Software Foundation.
11 *
12 * This library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
24#ifndef SYNCSIGHANDLER_H
25#define SYNCSIGHANDLER_H
26
27#include <QSocketNotifier>
28
40class SyncSigHandler : public QObject
41{
42 Q_OBJECT
43
44public:
50 SyncSigHandler(QObject *aParent = 0, const char *aName = 0);
51
56
57 // Unix signal handlers.
58 static void hupSignalHandler(int unused);
59 static void termSignalHandler(int unused);
60
61public slots:
66 void handleSigHup();
67
72 void handleSigTerm();
73
74private:
75 //socket pair for each Unix signal to handle
76 static int iSigHupFd[2];
77 static int iSigTermFd[2];
78
79 //QSocketNotifier to monitor the read end of each socket pair,
80 // declare your Unix signal handlers to be static class methods
81 QSocketNotifier *iSigHup;
82 QSocketNotifier *iSigTerm;
83
84#ifdef SYNCFW_UNIT_TESTS
85 friend class SyncSigHandlerTest;
86#endif
87};
88
89#endif // SYNCSIGHANDLER_H
~SyncSigHandler()
Destructor.
Definition SyncSigHandler.cpp:64
SyncSigHandler(QObject *aParent=0, const char *aName=0)
Constructor.
Definition SyncSigHandler.cpp:37
void handleSigTerm()
QT signal handler to handle SIG_TERM.
Definition SyncSigHandler.cpp:87
void handleSigHup()
QT signal handler to handle SIG_HUP.
Definition SyncSigHandler.cpp:98