From: Jason M. <jas...@vp...> - 2010-11-02 08:42:25
|
As I said before, you can't use threads on windows for this as they switch too infrequently. I first tried this using piglet and multiprocessing, I then get 10ms (which is obviously how frequently messages are passed by windows between the processors), but try as I might I can only get 99.99999Hz as Pyglet's graphics uses a separate thread. I did think of using message queues, (the producer/consumer model you suggest) and then passing more than one message per display thread pass. But why make things more complicated than they need be? And you still run into the lack of any thread priority so you can't guarantee windows running the thread you want it to. More of a problem, I would also inherent a 16ms latency in the display output. That is why Visual Python is so good and so fast. No imposed architecture to your code = simple fast execution. I got exactly what I want in just a few lines of code. I only wish I'd discovered it a year ago...... I'm no expert (I have no formal software training - I find courses too pedestrian, so I read books), as a result I've been able to program in various languages for about 30 years (25 in C and nearly ten in Python).... so I know a few tricks. -----Original Message----- From: Guy K. Kloss [mailto:guy...@au...] Sent: 02 November 2010 00:51 To: vis...@li... Subject: Re: [Visualpython-users] minor (if strange) bug with rate(x) On Tue, 02 Nov 2010 10:54:17 Jason Morgan wrote: > Now, the script *HAS* to run at a rate of at least 111.11 fps or it > breaks as the streaming data starts to back up and cease to be real time. I think in this case it would be better to evaluate using more loosely coupled coding, e. g. by using a producer/consumer design pattern. Have the receiving end run in a separate thread that can react immediately and chuck the data into a data structure that then can be updated in the GUI whenever needed. Some knowledge of software engineering can be helpful here. Guy -- Guy K. Kloss School of Computing + Mathematical Sciences Auckland University of Technology Private Bag 92006, Auckland 1142 phone: +64 9 921 9999 ext. 5032 eMail: Guy...@au... |