threading module, call thread.interrupt_main()

Discussion in 'Python' started by §ä´M¦Û¤vªº¤@¤ù¤Ñ, Oct 8, 2009.

  1. Sorry to ask, but i don't know how to solve it.

    I try to call thread.interrupt_main() function in my child thread's run method
    which is inherit threading.Thread class.

    But it didn't work, does anyone know why?

    Thanks a lot!!

    --
    ¡°Post by command from 59-124-255-226.HINET-IP.
    ¦Ñ¹«ªº­»­»¨Å¹T¬}£»¹q¤l§G§iÄæ¨t²Î£»alexbbs.twbbs.org£»140.113.166.7
    §ä´M¦Û¤vªº¤@¤ù¤Ñ, Oct 8, 2009
    #1
    1. Advertising

  2. §ä´M¦Û¤vªº¤@¤ù¤Ñ

    Simon Forman Guest

    2009/10/7 §ä´M¦Û¤vªº¤@¤ù¤Ñ <>:
    > Sorry to ask, but i don't know how to solve it.
    >
    > I try to call thread.interrupt_main() function in my child thread's run method
    > which is inherit threading.Thread class.
    >
    > But it didn't work, does anyone know why?
    >
    > Thanks a lot!!
    >


    "it didn't work" is not enough information.

    What is your code (smallest version that shows the problem)?

    And what is the traceback?
    Simon Forman, Oct 8, 2009
    #2
    1. Advertising

  3. En Thu, 08 Oct 2009 00:33:04 -0300, §ä´M¦Û¤vªº¤@¤ù¤Ñ
    <> escribió:

    > Sorry to ask, but i don't know how to solve it.


    No need to apologize!

    > I try to call thread.interrupt_main() function in my child thread's run
    > method
    > which is inherit threading.Thread class.
    >
    > But it didn't work, does anyone know why?


    Are you join()ing your child thread? In this case the main thread won't
    acknowledge the exception until the join() call returns -- probably too
    late. A sleep() call isn't interruptible either.

    I think it's already reported at http://bugs.python.org but I can't locate
    the issue right now.

    --
    Gabriel Genellina
    Gabriel Genellina, Oct 8, 2009
    #3
  4. En Thu, 08 Oct 2009 00:33:04 -0300, §ä´M¦Û¤vªº¤@¤ù¤Ñ
    <> escribió:

    > Sorry to ask, but i don't know how to solve it.


    No need to apologize!

    > I try to call thread.interrupt_main() function in my child thread's run
    > method
    > which is inherit threading.Thread class.
    >
    > But it didn't work, does anyone know why?


    Are you join()ing your child thread? In this case the main thread won't
    acknowledge the exception until the join() call returns -- probably too
    late. A sleep() call isn't interruptible either.

    I think it's already reported at http://bugs.python.org but I can't locate
    the issue right now.

    --
    Gabriel Genellina
    Gabriel Genellina, Oct 8, 2009
    #4
  5. En Thu, 08 Oct 2009 14:18:48 -0300, Gabriel Genellina
    <> escribió:
    > En Thu, 08 Oct 2009 00:33:04 -0300, §ä´M¦Û¤vªº¤@¤ù¤Ñ
    > <> escribió:
    >
    >> I try to call thread.interrupt_main() function in my child thread's run
    >> method
    >> which is inherit threading.Thread class.
    >> But it didn't work, does anyone know why?

    >
    > Are you join()ing your child thread? In this case the main thread won't
    > acknowledge the exception until the join() call returns -- probably too
    > late. A sleep() call isn't interruptible either.


    Could you confirm if this was actually your problem? Or something
    different?

    --
    Gabriel Genellina
    Gabriel Genellina, Oct 14, 2009
    #5
    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. Jerry Sievers

    thread, threading; how to kill a thread?

    Jerry Sievers, Nov 17, 2004, in forum: Python
    Replies:
    12
    Views:
    1,140
    Mustafa Demirhan
    Nov 19, 2004
  2. Jerry Sievers
    Replies:
    2
    Views:
    503
    Jerry Sievers
    Nov 21, 2004
  3. Replies:
    9
    Views:
    1,029
    Mark Space
    Dec 29, 2007
  4. Replies:
    5
    Views:
    1,605
    Roedy Green
    Jun 20, 2008
  5. Steven Woody
    Replies:
    0
    Views:
    403
    Steven Woody
    Jan 9, 2009
Loading...

Share This Page