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