summaryrefslogtreecommitdiff
path: root/libopie/oprocctrl.h
authortille <tille>2002-06-10 09:20:39 (UTC)
committer tille <tille>2002-06-10 09:20:39 (UTC)
commit81add8ce87168282bb56a15f0406f3fec75cf610 (patch) (unidiff)
tree13f2005e6b8db96df4cf54e74489a9784725e669 /libopie/oprocctrl.h
parentc479d93f2a8d7de836ef83c205f1a1789e49aa9a (diff)
downloadopie-81add8ce87168282bb56a15f0406f3fec75cf610.zip
opie-81add8ce87168282bb56a15f0406f3fec75cf610.tar.gz
opie-81add8ce87168282bb56a15f0406f3fec75cf610.tar.bz2
imported kprocess as oprocess
Diffstat (limited to 'libopie/oprocctrl.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/oprocctrl.h121
1 files changed, 121 insertions, 0 deletions
diff --git a/libopie/oprocctrl.h b/libopie/oprocctrl.h
new file mode 100644
index 0000000..5b39490
--- a/dev/null
+++ b/libopie/oprocctrl.h
@@ -0,0 +1,121 @@
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 OProcessControllerPrivate;
38class QSocketNotifier;
39
40/**
41 * @short Used internally by @ref OProcess
42 * @internal
43 * @author Christian Czezakte <e9025461@student.tuwien.ac.at>
44 *
45 * 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
47 * created (a pointer to it gets stored in @ref theOProcessController ).
48 *
49 * This class takes care of the actual (UN*X) signal handling.
50*/
51class OProcessController : public QObject
52{
53 Q_OBJECT
54
55public:
56 OProcessController();
57 ~OProcessController();
58 //CC: WARNING! Destructor Not virtual (but you don't derive classes from this anyhow...)
59
60public:
61
62 /**
63 * Only a single instance of this class is allowed at a time,
64 * and this static variable is used to track the one instance.
65 */
66 static OProcessController *theOProcessController;
67
68 /**
69 * Automatically called upon SIGCHLD.
70 *
71 * Normally you do not need to do anything with this function but
72 * if your application needs to disable SIGCHLD for some time for
73 * reasons beyond your control, you should call this function afterwards
74 * to make sure that no SIGCHLDs where missed.
75 */
76 static void theSigCHLDHandler(int signal);
77 // handler for sigchld
78
79 /**
80 * @internal
81 */
82 static void setupHandlers();
83 /**
84 * @internal
85 */
86 static void resetHandlers();
87 /**
88 * @internal
89 */
90 void addOProcess( OProcess* );
91 /**
92 * @internal
93 */
94 void removeOProcess( OProcess* );
95 public slots:
96 /**
97 * @internal
98 */
99 void slotDoHousekeeping(int socket);
100
101 private slots:
102 void delayedChildrenCleanup();
103private:
104 int fd[2];
105 QSocketNotifier *notifier;
106 static struct sigaction oldChildHandlerData;
107 static bool handlerSet;
108 QValueList<OProcess*> processList;
109 QTimer delayedChildrenCleanupTimer;
110
111 // Disallow assignment and copy-construction
112 OProcessController( const OProcessController& );
113 OProcessController& operator= ( const OProcessController& );
114
115 OProcessControllerPrivate *d;
116};
117
118
119
120#endif
121