Threaded GUI slowing method execution?

sturlamolden sturlamolden at yahoo.no
Fri Oct 2 14:22:19 EDT 2009


On 2 Okt, 02:51, Aaron Hoover <ahoo... at eecs.berkeley.edu> wrote:

> All the thread is doing most of the time is sitting around checking  
> the serial port for waiting data, reading it, and appending it to a  
> list when it finds it.

Do your threads ever block waiting for I/O? If they do, is the GIL
released while they are blocked?

If they don't, you could add a time.sleep(0) to the loop that polls
the port. It will return the rest of the current time slice back to
the system.














Then, in the same thread, the method that seems  
> to be remarkably slow works its way through that list looking for  
> packets of data and appending the packet payloads it finds to a queue  
> to be handled in some way by the GUI.
>
> My question is, what am I missing about either threading or the fact  
> that this is running in a GUI that might explain such a huge slowdown.  
> I'm sending data over the serial at a true rate of about 24k bytes per  
> second, or approximately 2 packets per ms. Is it too much to ask to be  
> able to process this data in realtime from within a GUI (I'm not  
> talking about plotting or anything - just read it and find packets)?  
> Like I said, the process pretty much runs in realtime from a command  
> line script.
>
> This packet parsing needs to happen continuously, so it seems calling  
> join() to ensure it's not interrupted by the GUI thread, won't work.
>
> Thanks in advance for your help.
>
> Aaron




More information about the Python-list mailing list