Multithreading

Ian Kelly ian.g.kelly at gmail.com
Tue Dec 27 00:21:11 EST 2011


On Dec 26, 2011 4:13 PM, "Yigit Turgut" <y.turgut at gmail.com> wrote:
> Why is there N variable in write_data function ? N is related to
> timer.tick(N) which is related to display function ? time.sleep(N)
> will pause writing to file for specified amount of time which is
> exactly what I am trying to avoid.

My understanding from your first post was that the pygame loop was supposed
to run at X FPS while the other loop was supposed to run every N seconds.
If that is not the case and the data loop is supposed to run as fast as
possible, then you don't need threads for this.  Just stream the data in a
tight loop, and on each iteration check the timer for how much time has
elapsed to determine whether to run the pygame code without using
timer.tick.  If not enough time has elapsed for your target framerate, just
skip that part.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20111226/e83e1f34/attachment-0001.html>


More information about the Python-list mailing list