Thread: stop an executing C program and finish executing additonal line of code

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    If it's responding, it will respond to a SIGTERM. If it's "not responding", a SIGTERM wouldn't work in any case, so even with your code you'd need to use a SIGKILL.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  2. #2
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by dwks
    If it's responding, it will respond to a SIGTERM. If it's "not responding", a SIGTERM wouldn't work in any case, so even with your code you'd need to use a SIGKILL.

    Usually a program which is 'not responding' will respond to a sigint if the signal handler is programed in a sensible way, similar to the way I described, ie not returning back to the
    main program. If you programmed it in the way with the 'stop' flag then when it was 'not
    responding' sending it a sigint would be a waste of time.
    Last edited by esbo; 08-31-2006 at 04:54 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Validating the contents of a char buffer
    By mattz in forum C Programming
    Replies: 3
    Last Post: 12-09-2001, 06:21 PM