Re: wierd threading behavior

2005-10-18 Thread dcrespo
> Hello, > I am just starting to play threading in python, here is a really > interesting problem I am very curious about: > " > import thread > def main(): >thread.start_new(test.()) First, delete the dot after "test". Second, is possibly that the Main() finishes before you can see the print

Re: wierd threading behavior

2005-10-18 Thread Tim Peters
[Qun Cao] >> import thread >> def main(): >> thread.start_new(test.()) >> >> def test(): >> print 'hello' >> >> main() >> " >> this program doesn't print out 'hello' as it is supposed to do. >> while if I change main() [Neil Hodgson] >The program has exited before the thread has manage

Re: wierd threading behavior

2005-10-17 Thread Qun Cao
Thanks Neil, that's very useful to know. Qun -- http://mail.python.org/mailman/listinfo/python-list

Re: wierd threading behavior

2005-10-14 Thread Neil Hodgson
Qun Cao: > import thread > def main(): > thread.start_new(test.()) > > def test(): > print 'hello' > > main() > " > this program doesn't print out 'hello' as it is supposed to do. > while if I change main() The program has exited before the thread has managed to run. It is undefine

Re: wierd threading behavior

2005-10-14 Thread Shitiz Bansal
seems that in the thread module, the stdout stream is captured by a single thread. Qun Cao <[EMAIL PROTECTED]> wrote: Thanks Sam,That was a stupid typo ( yeah, I actually typed it in :), it should be(test,()).I am using python 2.4.1 in ubuntu. I do aware that threading.Thread isprefered,but I did n

Re: wierd threading behavior

2005-10-14 Thread Qun Cao
Thanks Sam, That was a stupid typo ( yeah, I actually typed it in :), it should be (test,()). I am using python 2.4.1 in ubuntu. I do aware that threading.Thread is prefered, but I did not realize thread is deprecated. It is still a mysterious behavior anyhow. :) -- http://mail.python.org/mailm

Re: wierd threading behavior

2005-10-14 Thread Sam Pointon
thread is a low-level threading module, and start_new is deprecated. Aside from that, thread.start_new(test.()) is syntaxically wrong (a pair of brackets can't follow a dot). However, your example does work for me once I fix the syntax, and it prints hello but then hangs. I can't explain the other

wierd threading behavior

2005-10-14 Thread Qun Cao
Hello, I am just starting to play threading in python, here is a really interesting problem I am very curious about: " import thread def main(): thread.start_new(test.()) def test(): print 'hello' main() " this program doesn't print out 'hello' as it is supposed to do. while if I change