00001 /* This file is part of the KDE libraries 00002 Copyright (C) 1997 Christian Czezakte (e9025461@student.tuwien.ac.at) 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 Boston, MA 02111-1307, USA. 00018 */ 00019 // 00020 // KPROCESSCONTROLLER -- A helper class for KProcess 00021 // 00022 // version 0.3.1, Jan 8th 1997 00023 // 00024 // (C) Christian Czezatke 00025 // e9025461@student.tuwien.ac.at 00026 // Ported by Holger Freyther 00027 // 00028 00029 #ifndef __KPROCCTRL_H__ 00030 #define __KPROCCTRL_H__ 00031 00032 #include <qvaluelist.h> 00033 #include <qtimer.h> 00034 00035 #include "oprocess.h" 00036 00037 class QSocketNotifier; 00038 00039 00040 namespace Opie { 00041 namespace Core { 00042 namespace Internal { 00043 class OProcessControllerPrivate; 00044 00056 class OProcessController : public QObject 00057 { 00058 Q_OBJECT 00059 00060 public: 00061 OProcessController(); 00062 ~OProcessController(); 00063 //CC: WARNING! Destructor Not virtual (but you don't derive classes from this anyhow...) 00064 00065 public: 00066 00071 static OProcessController *theOProcessController; 00072 00081 static void theSigCHLDHandler(int signal); 00082 // handler for sigchld 00083 00087 static void setupHandlers(); 00091 static void resetHandlers(); 00095 void addOProcess( OProcess* ); 00099 void removeOProcess( OProcess* ); 00100 public slots: 00104 void slotDoHousekeeping(int socket); 00105 00106 private slots: 00107 void delayedChildrenCleanup(); 00108 private: 00109 int fd[2]; 00110 QSocketNotifier *notifier; 00111 static struct sigaction oldChildHandlerData; 00112 static bool handlerSet; 00113 QValueList<OProcess*> processList; 00114 QTimer delayedChildrenCleanupTimer; 00115 00116 // Disallow assignment and copy-construction 00117 OProcessController( const OProcessController& ); 00118 OProcessController& operator= ( const OProcessController& ); 00119 00120 OProcessControllerPrivate *d; 00121 }; 00122 00123 } 00124 } 00125 } 00126 00127 00128 #endif 00129
1.4.2