summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/threadutil.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/threadutil.h b/noncore/multimedia/opieplayer2/threadutil.h
index 1411535..2e83d3a 100644
--- a/noncore/multimedia/opieplayer2/threadutil.h
+++ b/noncore/multimedia/opieplayer2/threadutil.h
@@ -89,112 +89,111 @@ namespace ThreadUtil
89 89
90 Thread(); 90 Thread();
91 virtual ~Thread(); 91 virtual ~Thread();
92 92
93 void start(); 93 void start();
94 void terminate(); 94 void terminate();
95 95
96 bool wait(); 96 bool wait();
97 97
98 bool isRunning() const; 98 bool isRunning() const;
99 99
100 static void exit(); 100 static void exit();
101 protected: 101 protected:
102 virtual void run() = 0; 102 virtual void run() = 0;
103 103
104 private: 104 private:
105 Data *d; 105 Data *d;
106 }; 106 };
107 107
108 class OnewayNotifier : public QObject 108 class OnewayNotifier : public QObject
109 { 109 {
110 Q_OBJECT 110 Q_OBJECT
111 public: 111 public:
112 OnewayNotifier(); 112 OnewayNotifier();
113 ~OnewayNotifier(); 113 ~OnewayNotifier();
114 114
115 void notify(); 115 void notify();
116 116
117 signals: 117 signals:
118 void awake(); 118 void awake();
119 119
120 private slots: 120 private slots:
121 void wakeUp(); 121 void wakeUp();
122 122
123 private: 123 private:
124 int m_readFd; 124 int m_readFd;
125 int m_writeFd; 125 int m_writeFd;
126 QSocketNotifier *m_notifier; 126 QSocketNotifier *m_notifier;
127 }; 127 };
128 128
129 129
130 class Channel; 130 class Channel;
131 131
132 class ChannelMessage 132 class ChannelMessage
133 { 133 {
134 friend class Channel; 134 friend class Channel;
135 public: 135 public:
136 ChannelMessage( int type = -1 ); 136 ChannelMessage( int type = -1 );
137 virtual ~ChannelMessage(); 137 virtual ~ChannelMessage();
138 138
139 int type() const { return m_type; } 139 int type() const { return m_type; }
140 140
141 void reply(); 141 void reply();
142 142
143 private: 143 private:
144 ChannelMessage( const ChannelMessage & ); 144 ChannelMessage( const ChannelMessage & );
145 ChannelMessage &operator=( const ChannelMessage ); 145 ChannelMessage &operator=( const ChannelMessage );
146 146
147 int m_type; 147 int m_type;
148 bool m_isCall : 1; 148 bool m_isCall : 1;
149 bool m_replied : 1; 149 bool m_replied : 1;
150 bool m_inEventHandler : 1; 150 bool m_inEventHandler : 1;
151 Mutex m_guard; 151 Mutex m_guard;
152 WaitCondition m_condition; 152 WaitCondition m_condition;
153 QGuardedPtr<Channel> m_channel;
154 }; 153 };
155 154
156 class Channel : public QObject 155 class Channel : public QObject
157 { 156 {
158 Q_OBJECT 157 Q_OBJECT
159 public: 158 public:
160 enum SendType { OneWay, WaitForReply }; 159 enum SendType { OneWay, WaitForReply };
161 Channel( QObject *parent = 0, const char *name = 0 ); 160 Channel( QObject *parent = 0, const char *name = 0 );
162 virtual ~Channel(); 161 virtual ~Channel();
163 162
164 void send( ChannelMessage *message, SendType type ); 163 void send( ChannelMessage *message, SendType type );
165 164
166 protected: 165 protected:
167 virtual void receiveMessage( ChannelMessage *message, SendType type ) = 0; 166 virtual void receiveMessage( ChannelMessage *message, SendType type ) = 0;
168 167
169 private slots: 168 private slots:
170 void deliver(); 169 void deliver();
171 170
172 private: 171 private:
173 OnewayNotifier m_notifier; 172 OnewayNotifier m_notifier;
174 173
175 struct MsgEnvelope 174 struct MsgEnvelope
176 { 175 {
177 MsgEnvelope() : type( OneWay ), msg( 0 ) {} 176 MsgEnvelope() : type( OneWay ), msg( 0 ) {}
178 MsgEnvelope( SendType _type , ChannelMessage *_msg ) 177 MsgEnvelope( SendType _type , ChannelMessage *_msg )
179 : type( _type ), msg( _msg ) {} 178 : type( _type ), msg( _msg ) {}
180 179
181 SendType type; 180 SendType type;
182 ChannelMessage *msg; 181 ChannelMessage *msg;
183 }; 182 };
184 183
185 void deliverOne( const MsgEnvelope &envelope ); 184 void deliverOne( const MsgEnvelope &envelope );
186 185
187 typedef QValueList<MsgEnvelope> MsgEnvelopeList; 186 typedef QValueList<MsgEnvelope> MsgEnvelopeList;
188 187
189 MsgEnvelopeList m_pendingMessages; 188 MsgEnvelopeList m_pendingMessages;
190 Mutex m_pendingMessagesGuard; 189 Mutex m_pendingMessagesGuard;
191 190
192 struct Private; 191 struct Private;
193 Private *d; 192 Private *d;
194 }; 193 };
195 194
196} 195}
197 196
198#endif // THREADUTIL_H 197#endif // THREADUTIL_H
199/* vim: et sw=4 ts=4 198/* vim: et sw=4 ts=4
200 */ 199 */