author | harlekin <harlekin> | 2002-06-10 09:39:23 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-06-10 09:39:23 (UTC) |
commit | ca3838f3aa3bbfa3aba61f7aaa285b9be67ca426 (patch) (unidiff) | |
tree | b14274bbff3cd1140b9b1a1c84c2e97b712f1828 /core/applets/obex/kprocctrl.h | |
parent | 81add8ce87168282bb56a15f0406f3fec75cf610 (diff) | |
download | opie-ca3838f3aa3bbfa3aba61f7aaa285b9be67ca426.zip opie-ca3838f3aa3bbfa3aba61f7aaa285b9be67ca426.tar.gz opie-ca3838f3aa3bbfa3aba61f7aaa285b9be67ca426.tar.bz2 |
initial try
Diffstat (limited to 'core/applets/obex/kprocctrl.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/applets/obex/kprocctrl.h | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/core/applets/obex/kprocctrl.h b/core/applets/obex/kprocctrl.h new file mode 100644 index 0000000..ac82b9d --- a/dev/null +++ b/core/applets/obex/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 | |||