Tuvas wrote:
> I have a program running several threads. One of them must be done
> every (Specified time, usually 1 second). The whole point to having a
> thread is do this. However, I've noticed the following. When there is
> another part of the program that is active, this thread slips into
> disuse, ei, it's only ran about once every 4-5 seconds, or perhaps it
> waits for a lul in the computing process. How can I ensure that this
> does not happen? This thread uses little processing power, so it could
> be set to a high priority, if there is a way to do this. Thanks!
>
>   
I think that might be difficult using python threads simply based on how 
python controls the global interpreter lock.

One suggestion I might have is to have python release the global 
interpreter lock more frequently, you can read about the global 
interpreter lock here:

http://docs.python.org/api/threads.html

You might also be able to use some timer/condition construct in 
combination with this, something like

Thread A:
if watchdogTimer():
  conditionVar.aquire()
  conditionVar.notify(threadB)
  conditionVar.release()

ThreadB:
while(1):
  conditionVar.aquire()
  conditionVar.wait()
  functionToDoSomething()
 
This is pseudo python of course, if you need to know about these objects 
I would suggest consulting the python manual.

-carl

-- 

Carl J. Van Arsdall
[EMAIL PROTECTED]
Build and Release
MontaVista Software

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to