control-c and threads, signals in 2.3 causing all sorts of issues

Discussion in 'Python' started by Srikanth Mandava, Feb 18, 2004.

  1. Hi!

    When a signal handler is registered in the main thread and
    "control-c" is entered, the child thread is getting the
    KeyboardInterrupt exception(The documentation says the main thread
    MUST receive the signal handler function call if handler is
    registered).

    In python 2.2.1 the main thread was always called with
    the sigint signal handler which was registered. In my case the
    child thread is waiting on stdin using "raw_input" function. This
    seems to be causing all sorts of strange behavior in the program
    once the child thread gets the keyboardinterrupt exception and
    eventually leading to seg fault on a sys exit .

    Any idea why this is happening in 2.3.1? This scenario worked in
    2.2.1. Is this fixed in 2.3.2?.


    Thanks
    Srikanth
    Srikanth Mandava, Feb 18, 2004
    #1
    1. Advertising

  2. Re: control-c and threads, signals in 2.3 causing all sorts ofissues

    Srikanth Mandava <> writes:

    > Hi!
    >
    > When a signal handler is registered in the main thread and
    > "control-c" is entered, the child thread is getting the
    > KeyboardInterrupt exception(The documentation says the main thread
    > MUST receive the signal handler function call if handler is
    > registered).


    Hmm. Threads + signals == mwh running off screaming...

    > In python 2.2.1 the main thread was always called with
    > the sigint signal handler which was registered. In my case the
    > child thread is waiting on stdin using "raw_input" function. This
    > seems to be causing all sorts of strange behavior in the program
    > once the child thread gets the keyboardinterrupt exception and
    > eventually leading to seg fault on a sys exit .


    Oh oh, if you're using raw_input(), readline might be getting
    involved...

    > Any idea why this is happening in 2.3.1? This scenario worked in
    > 2.2.1. Is this fixed in 2.3.2?.


    Is this thread relavent?

    http://groups.google.com/groups?threadm=

    OS, libc and versions of same might be useful, too.

    Cheers,
    mwh

    --
    I located the link but haven't bothered to re-read the article,
    preferring to post nonsense to usenet before checking my facts.
    -- Ben Wolfson, comp.lang.python
    Michael Hudson, Feb 19, 2004
    #2
    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. funtoosh
    Replies:
    3
    Views:
    552
    Brian McCauley
    Feb 17, 2004
  2. CMOS
    Replies:
    1
    Views:
    306
    Jack Klein
    Aug 29, 2006
  3. Jonathan Wood
    Replies:
    2
    Views:
    306
    Jonathan Wood
    Jun 18, 2008
  4. Replies:
    6
    Views:
    527
    Tim Rentsch
    Mar 23, 2010
  5. Christopher Pisz

    sorts and iterators

    Christopher Pisz, Jun 30, 2013, in forum: C++
    Replies:
    10
    Views:
    290
    Ike Naar
    Jul 1, 2013
Loading...

Share This Page