passing threading.Thread() and function object

Discussion in 'Python' started by Christopher J. Bottaro, Oct 13, 2004.

  1. Hello,

    I'm new to Python programming, so please excuse me.

    thread = threading.Thread(self.somefunc())
    thread.start()
    print "Thread started"

    def somefunc(self):
    while (1)
    print "In thread"


    "Thread started" never gets printed, but "In thread" gets printed
    repeatedly. What is going on? It seems like thread.start() is blocking
    and effectively running self.somefunc() as a normal function.

    Thanks for the help.
    Christopher J. Bottaro, Oct 13, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James Vanns
    Replies:
    7
    Views:
    7,003
    Evan Carew
    Jan 21, 2004
  2. sashan
    Replies:
    4
    Views:
    278
    Peter Hansen
    Oct 5, 2003
  3. Jerry Sievers

    thread, threading; how to kill a thread?

    Jerry Sievers, Nov 17, 2004, in forum: Python
    Replies:
    12
    Views:
    1,118
    Mustafa Demirhan
    Nov 19, 2004
  4. Replies:
    9
    Views:
    1,001
    Mark Space
    Dec 29, 2007
  5. Steven Woody
    Replies:
    0
    Views:
    393
    Steven Woody
    Jan 9, 2009
Loading...

Share This Page