PDA

View Full Version : Serial and TCp and threadss



cafu
22nd December 2009, 18:07
Hi everybody i have a small question i have several serial devices, each of then need to be check all the time, plus the possibility to set some stuff on then. I also have a server and several client connected using QtcpSocket and QtcpServer.

The clients are the one that see the information and set thing to serial devices.

I have a made a thread for each serial, and a thread that control the the server as well a thread for the client.

things seems to work properly but i am affraid that this is no a good solution.

The client should send a request to the server, the server say to the device that need to perfomed a command the answer is receive and the is transmited to the client,

in the meantime the client should not be able to send a new command but it can receive message from the server.

Beside Thread for wait and no block the guis(clients and server), what other option do i have.

high_flyer
23rd December 2009, 12:01
Why do you think your threaded solution is not good?
And if it works, then what is the problem?

cafu1007
6th January 2010, 15:00
Hi, it is working, but the software should run in pc that only have one procesor, and at the end it can be more than 10 thread working together, and i am not sure how this is going to work, andit does not matter how many test i make, i can not see all the problem that this can cause

cafu1007
7th January 2010, 12:24
Hi there,

Something else: the serial devices(class) trigger signals(the same signature) that are connected to same slot in the controller. What happen when the devices trigger a the same time the signal.
What happens when the the slot is processing some data in the slot and a new signal is triggered, What happens if in the slot, i block with a mutex and a second signal is triggered.


This is no so clear for me. Could someone explain me this. I am not sure whether is going to be a deadlocks, or lost of signal or this are going to be queued

Thanks for the help

Lesiok
7th January 2010, 13:52
If signal emiter and receiver are in one thread in standard mode emiting signal is de facto calling receiver function. So event loop is not working until receiver returns.
If signal emiter and receiver are in different threads signals are queued. Look here (http://doc.trolltech.com/4.6/qt.html#ConnectionType-enum)

cafu
7th January 2010, 14:09
well they are in different thread so they should be queued,


Thanks.

one thing with the BlockingQueuedConnection as soon as the slot can be called the other signaling thread is unblock

cafu
11th January 2010, 16:24
HI,

i am having some issues i am running the application in the deploy machine, and its given me error when i closed or sometimes when i opened, it saying the the application crash and drWatson had a log entry. the target machine is running Windows XP embedded, but when i tried to debug in my machine everything goes ok no error and no crashing.

can someone read the log from dr watson an maybe give some hints.

thanks carlos