[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Problem on thread support in KDE application
From:       kaiduan xie <kaiduanx () yahoo ! ca>
Date:       2003-09-08 8:05:45
[Download RAW message or body]

Hi, all,

I am going to make a software thread-safe. I run a
separate thread for receiving packet from network.

In the network thread which keeps receiving packets
from network, a GUI window may be showed from the
network thread upon receing some kind of packets. I
already used pthread_mutex_t to lock and unlock the
common resouce used by GUI thread and network thread.

In the main() function, I wrote as follows:

KApplicaiton a;

AWidget* awidget = new AWidget();
awidget->show();
awidget->startThread();
return a.exec();

AWidget is a subclass of KMainWindow(); In
awidget->startThread(), I use pthread_create() to
create a thread.

However, when I debuged the progam, and set the
breakpoint into startThread(), after running
pthread_create(), the following message poped up:


[New Thread 8192 (LWP 2905)]
[Switching to Thread 8192 (LWP 2905)]

Breakpoint 1, KPhone::startSipThread()
(this=0x814c718) at kphone.cpp:287
287             if (pthread_create(&sipThreadId,NULL,
sipThreadFunc, this) != 0) {
(gdb) n
[New Thread 16385 (LWP 2906)]
[New Thread 8194 (LWP 2907)]

QMutex::unlock: unlock from different thread than
locker was locked by 8192, unlock attempt from 8194

What is the reason? And how to do that in this
scenario?


Thanks for help.

kaiduan

______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic