> 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
[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
Thanks Neil, that's very useful to know.
Qun
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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