00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
#ifndef __KPROCCTRL_H__
00021
#define __KPROCCTRL_H__
00022
00023
#include <qvaluelist.h>
00024
00025
#include "kprocess.h"
00026
00027
class QSocketNotifier;
00028
00039 class KDECORE_EXPORT KProcessController :
public QObject
00040 {
00041 Q_OBJECT
00042
00043
public:
00048
static void ref();
00049
00054
static void deref();
00055
00060
static KProcessController *theKProcessController;
00061
00069
static void theSigCHLDHandler(
int signal);
00070
00081
bool waitForProcessExit(
int timeout);
00082
00088
void unscheduleCheck();
00089
00095
void rescheduleCheck();
00096
00097
00098
00099
00100
00101
00102
00103
00104
int notifierFd()
const;
00105
00109
void addKProcess(
KProcess* );
00113
void removeKProcess(
KProcess* );
00117
void addProcess(
int pid );
00118
00119
private slots:
00120
void slotDoHousekeeping();
00121
00122
private:
00123
friend class I_just_love_gcc;
00124
00125
int fd[2];
00126
bool needcheck;
00127
QSocketNotifier *notifier;
00128
QValueList<KProcess*> kProcessList;
00129
QValueList<int> unixProcessList;
00130
00131
static void setupHandlers();
00132
static void resetHandlers();
00133
static struct sigaction oldChildHandlerData;
00134
static bool handlerSet;
00135
00136
static int refCount;
00137
00138
00139 KProcessController();
00140 ~KProcessController();
00141
00142
00143 KProcessController(
const KProcessController& );
00144 KProcessController& operator= (
const KProcessController& );
00145 };
00146
00147
00148
00149
#endif
00150