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 OProcessControllerPrivate; 00038 class QSocketNotifier; 00039 00051 class OProcessController : public QObject 00052 { 00053 Q_OBJECT 00054 00055 public: 00056 OProcessController(); 00057 ~OProcessController(); 00058 //CC: WARNING! Destructor Not virtual (but you don't derive classes from this anyhow...) 00059 00060 public: 00061 00066 static OProcessController *theOProcessController; 00067 00076 static void theSigCHLDHandler(int signal); 00077 // handler for sigchld 00078 00082 static void setupHandlers(); 00086 static void resetHandlers(); 00090 void addOProcess( OProcess* ); 00094 void removeOProcess( OProcess* ); 00095 public slots: 00099 void slotDoHousekeeping(int socket); 00100 00101 private slots: 00102 void delayedChildrenCleanup(); 00103 private: 00104 int fd[2]; 00105 QSocketNotifier *notifier; 00106 static struct sigaction oldChildHandlerData; 00107 static bool handlerSet; 00108 QValueList<OProcess*> processList; 00109 QTimer delayedChildrenCleanupTimer; 00110 00111 // Disallow assignment and copy-construction 00112 OProcessController( const OProcessController& ); 00113 OProcessController& operator= ( const OProcessController& ); 00114 00115 OProcessControllerPrivate *d; 00116 }; 00117 00118 00119 00120 #endif 00121
1.4.2