kdecore Library API Documentation

kprocctrl.h

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 //
00027 
00028 #ifndef __KPROCCTRL_H__
00029 #define __KPROCCTRL_H__
00030 
00031 #include <qvaluelist.h>
00032 #include <qtimer.h>
00033 
00034 #include "kprocess.h"
00035 
00036 class KProcessControllerPrivate;
00037 class QSocketNotifier;
00038 
00050 class KProcessController : public QObject
00051 {
00052   Q_OBJECT
00053 
00054 public:
00055   KProcessController();
00056   ~KProcessController(); 
00057   //CC: WARNING! Destructor Not virtual (but you don't derive classes from this anyhow...)
00058 
00059 public:
00060         
00065   static KProcessController *theKProcessController;
00066 
00075   static void theSigCHLDHandler(int signal);
00076   // handler for sigchld
00077   
00081   static void setupHandlers();
00085   static void resetHandlers();
00089   void addKProcess( KProcess* );
00093   void removeKProcess( KProcess* );
00094   
00105   bool waitForProcessExit(int timeout);
00106 
00107 public slots:
00111  void slotDoHousekeeping(int socket);
00112 
00113 private slots:
00114  void delayedChildrenCleanup();
00115 
00116 private:
00117   int fd[2];
00118   QSocketNotifier *notifier;
00119   static struct sigaction oldChildHandlerData;
00120   static bool handlerSet;
00121   QValueList<KProcess*> processList;
00122   QTimer delayedChildrenCleanupTimer;
00123 
00124   // Disallow assignment and copy-construction
00125   KProcessController( const KProcessController& );
00126   KProcessController& operator= ( const KProcessController& );
00127 
00128   KProcessControllerPrivate *d;
00129 };
00130 
00131 
00132 
00133 #endif
00134 
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:46:45 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001