serial ports, threads and windows

Tom Brown brown at esteem.com
Wed Aug 9 20:01:41 EDT 2006


On Wednesday 02 August 2006 16:02, Tom Brown wrote:
> I've written a python app that r/w eight serial ports to control eight
> devices using eight threads. This all works very nicely in Linux. I even
> put a GUI on it using PyQt4. Still works nicely.
>
> Then I put the app on on a virtual Windows machine running inside of vmware
> on the same Linux box.  Vmware only lets me have four serial ports so I run
> the app against four serial ports using four threads. The app did not
> respond quick enough to data from the serial ports and eventually hung.
>
> So, I tried one serial port and the app still did not respond quick enough
> to the single serial port. It eventually hangs.
>
> When the app hung, in each case, it was not hogging the cpu nor reading any
> data off the serial ports. The task manager didn't show it was doing
> anything at all.

I haven't found the fix, but I have found the culprit.

There are eight threads and eight edit widgets. Each thread is posting 
messages to an edit widget created for that thread (not by that thread). The 
messages are characters read off the serial port. I am actually posting a 
line at a time, not a character at a time. The idea is that the user can see 
what is happening on the serial port in the event something goes wrong that 
the application cannot recover from. When I modified the app so the threads 
were NOT posting messages, the app worked as expected.

This was never an issue in Linux. So, does that mean that this is a Windows 
problem? Or a Qt4 problem? I am curious to know if anybody has written a 
python app with many threads posting messages to the main application. How 
well did it work? What gui toolkit did you use?

Thanks,
Tom



More information about the Python-list mailing list