summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/threadutil.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/threadutil.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/threadutil.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/threadutil.cpp b/noncore/multimedia/opieplayer2/threadutil.cpp
index fb951b4..d8b8abe 100644
--- a/noncore/multimedia/opieplayer2/threadutil.cpp
+++ b/noncore/multimedia/opieplayer2/threadutil.cpp
@@ -166,58 +166,58 @@ static void *start_thread( void *arg )
166 166
167 Thread::exit(); 167 Thread::exit();
168 return 0; // never reached 168 return 0; // never reached
169} 169}
170 170
171} 171}
172 172
173Thread::Thread() 173Thread::Thread()
174 : d( new Data ) 174 : d( new Data )
175{ 175{
176 d->thr = this; 176 d->thr = this;
177} 177}
178 178
179Thread::~Thread() 179Thread::~Thread()
180{ 180{
181 assert( d->isRunning == false ); 181 assert( d->isRunning == false );
182 delete d; 182 delete d;
183} 183}
184 184
185void Thread::start() 185void Thread::start()
186{ 186{
187 AutoLock lock( d->guard ); 187 AutoLock lock( d->guard );
188 188
189 if ( d->isRunning ) { 189 if ( d->isRunning ) {
190 qDebug( "ThreadUtil::Thread::start() called for running thread." ); 190 odebug << "ThreadUtil::Thread::start() called for running thread." << oendl;
191 return; 191 return;
192 } 192 }
193 193
194 pthread_attr_t attributes; 194 pthread_attr_t attributes;
195 pthread_attr_init( &attributes ); 195 pthread_attr_init( &attributes );
196 pthread_attr_setscope( &attributes, PTHREAD_SCOPE_SYSTEM ); 196 pthread_attr_setscope( &attributes, PTHREAD_SCOPE_SYSTEM );
197 int err = pthread_create( &d->self, &attributes, start_thread, ( void* )d ); 197 int err = pthread_create( &d->self, &attributes, start_thread, ( void* )d );
198 if ( err != 0 ) { 198 if ( err != 0 ) {
199 qDebug( "ThreadUtil::Thread::start() : can't create thread: %s", strerror( err ) ); 199 odebug << "ThreadUtil::Thread::start() : can't create thread: " << strerror( err ) << "" << oendl;
200 pthread_attr_destroy( &attributes ); 200 pthread_attr_destroy( &attributes );
201 return; 201 return;
202 } 202 }
203 pthread_attr_destroy( &attributes ); 203 pthread_attr_destroy( &attributes );
204} 204}
205 205
206void Thread::terminate() 206void Thread::terminate()
207{ 207{
208 AutoLock lock( d->guard ); 208 AutoLock lock( d->guard );
209 if ( !d->isRunning ) 209 if ( !d->isRunning )
210 return; 210 return;
211 211
212 pthread_cancel( d->self ); 212 pthread_cancel( d->self );
213} 213}
214 214
215bool Thread::wait() 215bool Thread::wait()
216{ 216{
217 AutoLock lock( d->guard ); 217 AutoLock lock( d->guard );
218 if ( !d->isRunning ) 218 if ( !d->isRunning )
219 return true; 219 return true;
220 220
221 return d->finishCondition.wait( d->guard ); 221 return d->finishCondition.wait( d->guard );
222} 222}
223 223
@@ -263,49 +263,49 @@ void OnewayNotifier::wakeUp()
263 char c = 0; 263 char c = 0;
264 264
265 if ( ::read( m_readFd, &c, 1 ) != 1 ) 265 if ( ::read( m_readFd, &c, 1 ) != 1 )
266 return; 266 return;
267 267
268 emit awake(); 268 emit awake();
269} 269}
270 270
271ChannelMessage::ChannelMessage( int type ) 271ChannelMessage::ChannelMessage( int type )
272 : m_type( type ), m_isCall( false ), m_replied( false ), 272 : m_type( type ), m_isCall( false ), m_replied( false ),
273 m_inEventHandler( false ) 273 m_inEventHandler( false )
274{ 274{
275} 275}
276 276
277ChannelMessage::~ChannelMessage() 277ChannelMessage::~ChannelMessage()
278{ 278{
279 if ( m_guard.isLocked() ) 279 if ( m_guard.isLocked() )
280 m_guard.unlock(); 280 m_guard.unlock();
281} 281}
282 282
283void ChannelMessage::reply() 283void ChannelMessage::reply()
284{ 284{
285 if ( !m_isCall ) 285 if ( !m_isCall )
286 { 286 {
287 qDebug( "ChannelMessage::reply() - can't reply oneway message!" ); 287 odebug << "ChannelMessage::reply() - can't reply oneway message!" << oendl;
288 return; 288 return;
289 } 289 }
290 290
291 if ( m_inEventHandler ) 291 if ( m_inEventHandler )
292 { 292 {
293 m_replied = true; 293 m_replied = true;
294 return; 294 return;
295 } 295 }
296 296
297 m_condition.wakeOne(); 297 m_condition.wakeOne();
298 m_guard.unlock(); 298 m_guard.unlock();
299} 299}
300 300
301struct Channel::Private 301struct Channel::Private
302{ 302{
303 Private() 303 Private()
304 { 304 {
305 ownerThread = pthread_self(); 305 ownerThread = pthread_self();
306 } 306 }
307 307
308 pthread_t ownerThread; 308 pthread_t ownerThread;
309}; 309};
310 310
311Channel::Channel( QObject *parent, const char *name ) 311Channel::Channel( QObject *parent, const char *name )