summaryrefslogtreecommitdiffabout
path: root/microkde/oprocctrl.h
authorzautrix <zautrix>2004-07-03 17:03:05 (UTC)
committer zautrix <zautrix>2004-07-03 17:03:05 (UTC)
commitd6c945f1c48c6b6742751177d07e88dca3f3044d (patch) (unidiff)
tree8720a31b685480503aa3b5a3b3328dcddcdbc6cb /microkde/oprocctrl.h
parent65ed57d77ba421169b62f46f59ae6b1d7a228e3d (diff)
downloadkdepimpi-d6c945f1c48c6b6742751177d07e88dca3f3044d.zip
kdepimpi-d6c945f1c48c6b6742751177d07e88dca3f3044d.tar.gz
kdepimpi-d6c945f1c48c6b6742751177d07e88dca3f3044d.tar.bz2
Added 4 opie files. Updated pro file.
Diffstat (limited to 'microkde/oprocctrl.h') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/oprocctrl.h129
1 files changed, 129 insertions, 0 deletions
diff --git a/microkde/oprocctrl.h b/microkde/oprocctrl.h
new file mode 100644
index 0000000..ea00859
--- a/dev/null
+++ b/microkde/oprocctrl.h
@@ -0,0 +1,129 @@
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// Ported by Holger Freyther
27//
28
29#ifndef __KPROCCTRL_H__
30#define __KPROCCTRL_H__
31
32#include <qvaluelist.h>
33#include <qtimer.h>
34
35#include "oprocess.h"
36
37class QSocketNotifier;
38
39
40namespace Opie {
41namespace Core {
42namespace Internal {
43class OProcessControllerPrivate;
44
45/**
46 * @short Used internally by @ref OProcess
47 * @internal
48 * @author Christian Czezakte <e9025461@student.tuwien.ac.at>
49 *
50 * A class for internal use by OProcess only. -- Exactly one instance
51 * of this class is generated by the first instance of OProcess that is
52 * created (a pointer to it gets stored in @ref theOProcessController ).
53 *
54 * This class takes care of the actual (UN*X) signal handling.
55*/
56class OProcessController : public QObject
57{
58 Q_OBJECT
59
60public:
61 OProcessController();
62 ~OProcessController();
63 //CC: WARNING! Destructor Not virtual (but you don't derive classes from this anyhow...)
64
65public:
66
67 /**
68 * Only a single instance of this class is allowed at a time,
69 * and this static variable is used to track the one instance.
70 */
71 static OProcessController *theOProcessController;
72
73 /**
74 * Automatically called upon SIGCHLD.
75 *
76 * Normally you do not need to do anything with this function but
77 * if your application needs to disable SIGCHLD for some time for
78 * reasons beyond your control, you should call this function afterwards
79 * to make sure that no SIGCHLDs where missed.
80 */
81 static void theSigCHLDHandler(int signal);
82 // handler for sigchld
83
84 /**
85 * @internal
86 */
87 static void setupHandlers();
88 /**
89 * @internal
90 */
91 static void resetHandlers();
92 /**
93 * @internal
94 */
95 void addOProcess( OProcess* );
96 /**
97 * @internal
98 */
99 void removeOProcess( OProcess* );
100public slots:
101 /**
102 * @internal
103 */
104 void slotDoHousekeeping(int socket);
105
106private slots:
107 void delayedChildrenCleanup();
108private:
109 int fd[2];
110 QSocketNotifier *notifier;
111 static struct sigaction oldChildHandlerData;
112 static bool handlerSet;
113 QValueList<OProcess*> processList;
114 QTimer delayedChildrenCleanupTimer;
115
116 // Disallow assignment and copy-construction
117 OProcessController( const OProcessController& );
118 OProcessController& operator= ( const OProcessController& );
119
120 OProcessControllerPrivate *d;
121};
122
123}
124}
125}
126
127
128#endif
129