peter at engcorp.com
Wed Jan 29 16:37:49 CET 2003
Lukas Kubin wrote:
> It's been half a day since I sent a more describing response to the news.
> Until now it didn't appear there. So I will try to be more clear now
> (I'm running it on linux and python 2.2.1)
> The main call looks like:
> if __name__ == '__main__':
> for comp in ['hostname1','hostname2']:
> thread = Control(comp)
> The doTheAction() function uses socket to connect to a computer and send a
> command there.
> When I don't use the time.sleep() then it starts 2 threads of 'hostname2'
> so it connects 2 times to hostname2 but not to hostname1.
Please go back and read my first reply again.
With the extra information (still minimal... please post doTheAction()!)
you've provided, I'm now more convinced that my first guess was correct.
You very likely have a code-reentrancy problem, possibly because you're
using a global variable (?), which is causing the problem.
The above code is certainly starting two threads. The issue is how
does the first thread hear about "hostname2" instead of "hostname1".
The only likely answer is that you do not have thread-safe code.
Please post doTheAction() if you can't find the problem yourself.
Without it, we're stuck.
More information about the Python-list