author | benmeyer <benmeyer> | 2002-09-30 14:26:33 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-09-30 14:26:33 (UTC) |
commit | 9965bd5c49ff2f22d640d132ac343fdec97b3fb4 (patch) (unidiff) | |
tree | 45e8f1d1bf414530b637692ba43b730110611856 /noncore/settings/networksettings/kprocctrl.h | |
parent | 5db3af80f392f8f063f53cbbad67bbe7c5c6eb6d (diff) | |
download | opie-9965bd5c49ff2f22d640d132ac343fdec97b3fb4.zip opie-9965bd5c49ff2f22d640d132ac343fdec97b3fb4.tar.gz opie-9965bd5c49ff2f22d640d132ac343fdec97b3fb4.tar.bz2 |
Initial commit
Diffstat (limited to 'noncore/settings/networksettings/kprocctrl.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/kprocctrl.h | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/noncore/settings/networksettings/kprocctrl.h b/noncore/settings/networksettings/kprocctrl.h new file mode 100644 index 0000000..ac82b9d --- a/dev/null +++ b/noncore/settings/networksettings/kprocctrl.h | |||
@@ -0,0 +1,120 @@ | |||
1 | /* This file is part of the KDE libraries | ||
2 | Copyright (C) 1997 Christian Czezakte (e9025461@student.tuwien.ac.at) | ||
3 | |||
4 | This library is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU Library General Public | ||
6 | License as published by the Free Software Foundation; either | ||
7 | version 2 of the License, or (at your option) any later version. | ||
8 | |||
9 | This library is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | Library General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Library General Public License | ||
15 | along with this library; see the file COPYING.LIB. If not, write to | ||
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
17 | Boston, MA 02111-1307, USA. | ||
18 | */ | ||
19 | // | ||
20 | // KPROCESSCONTROLLER -- A helper class for KProcess | ||
21 | // | ||
22 | // version 0.3.1, Jan 8th 1997 | ||
23 | // | ||
24 | // (C) Christian Czezatke | ||
25 | // e9025461@student.tuwien.ac.at | ||
26 | // | ||
27 | |||
28 | #ifndef __KPROCCTRL_H__ | ||
29 | #define __KPROCCTRL_H__ | ||
30 | |||
31 | #include <qvaluelist.h> | ||
32 | #include <qtimer.h> | ||
33 | |||
34 | #include "kprocess.h" | ||
35 | |||
36 | class KProcessControllerPrivate; | ||
37 | class QSocketNotifier; | ||
38 | |||
39 | /** | ||
40 | * @short Used internally by @ref KProcess | ||
41 | * @internal | ||
42 | * @author Christian Czezakte <e9025461@student.tuwien.ac.at> | ||
43 | * | ||
44 | * A class for internal use by KProcess only. -- Exactly one instance | ||
45 | * of this class is generated by the first instance of KProcess that is | ||
46 | * created (a pointer to it gets stored in @ref theKProcessController ). | ||
47 | * | ||
48 | * This class takes care of the actual (UN*X) signal handling. | ||
49 | */ | ||
50 | class KProcessController : public QObject | ||
51 | { | ||
52 | Q_OBJECT | ||
53 | |||
54 | public: | ||
55 | KProcessController(); | ||
56 | ~KProcessController(); | ||
57 | //CC: WARNING! Destructor Not virtual (but you don't derive classes from this anyhow...) | ||
58 | |||
59 | public: | ||
60 | |||
61 | /** | ||
62 | * Only a single instance of this class is allowed at a time, | ||
63 | * and this static variable is used to track the one instance. | ||
64 | */ | ||
65 | static KProcessController *theKProcessController; | ||
66 | |||
67 | /** | ||
68 | * Automatically called upon SIGCHLD. | ||
69 | * | ||
70 | * Normally you do not need to do anything with this function but | ||
71 | * if your application needs to disable SIGCHLD for some time for | ||
72 | * reasons beyond your control, you should call this function afterwards | ||
73 | * to make sure that no SIGCHLDs where missed. | ||
74 | */ | ||
75 | static void theSigCHLDHandler(int signal); | ||
76 | // handler for sigchld | ||
77 | |||
78 | /** | ||
79 | * @internal | ||
80 | */ | ||
81 | static void setupHandlers(); | ||
82 | /** | ||
83 | * @internal | ||
84 | */ | ||
85 | static void resetHandlers(); | ||
86 | /** | ||
87 | * @internal | ||
88 | */ | ||
89 | void addKProcess( KProcess* ); | ||
90 | /** | ||
91 | * @internal | ||
92 | */ | ||
93 | void removeKProcess( KProcess* ); | ||
94 | public slots: | ||
95 | /** | ||
96 | * @internal | ||
97 | */ | ||
98 | void slotDoHousekeeping(int socket); | ||
99 | |||
100 | private slots: | ||
101 | void delayedChildrenCleanup(); | ||
102 | private: | ||
103 | int fd[2]; | ||
104 | QSocketNotifier *notifier; | ||
105 | static struct sigaction oldChildHandlerData; | ||
106 | static bool handlerSet; | ||
107 | QValueList<KProcess*> processList; | ||
108 | QTimer delayedChildrenCleanupTimer; | ||
109 | |||
110 | // Disallow assignment and copy-construction | ||
111 | KProcessController( const KProcessController& ); | ||
112 | KProcessController& operator= ( const KProcessController& ); | ||
113 | |||
114 | KProcessControllerPrivate *d; | ||
115 | }; | ||
116 | |||
117 | |||
118 | |||
119 | #endif | ||
120 | |||