is this an signal handler or a alarm ?

Discussion in 'C Programming' started by LeTubs, Apr 30, 2004.

  1. LeTubs

    LeTubs Guest

    Hi

    I'm not sure if this is correct ...place to post but here goes

    This is what i'm trying to do, I want to write a signal / alarm handler
    ( I don't know which hence the posting here, as once I know the proper
    name /useage then I'll use google to try and find out more
    information )....
    Thus any tips or pointers would be helpful (and I'm using a UNIX variant as
    OS)

    Many Thanks
    David

    the (?) means I'm not sure if I need the variable or not...

    xxxxxxx( &MyTimeFunction, (?)(void *)SleepCounter );

    do_some_other_work(......)
    ..
    ..
    ..
    /* Check to see if the sleep counter has been set (ie it has
    waited a specific time or timeout period
    */
    xxxxxxx( SleepCounter );

    void * MyTimeFunction( void * arg ){

    int MySleepCounter = (int) arg;
    for ( i = 0; i < SOME_SYSTEM_COUNTER; i++ ){}

    /* Not sure on this bit also but want to set a value of 1
    to denote the sleep time has been set
    */
    SleepCounter = 1;
    }
     
    LeTubs, Apr 30, 2004
    #1
    1. Advertisements

  2. LeTubs <> spoke thus:

    > I'm not sure if this is correct ...place to post but here goes


    (It isn't. Now you know.)

    Your post is off-topic for comp.lang.c. Please visit

    http://www.ungerhu.com/jxh/clc.welcome.txt
    http://www.eskimo.com/~scs/C-faq/top.html
    http://benpfaff.org/writings/clc/off-topic.html

    for posting guidelines and frequently asked questions. Thank you.

    --
    Christopher Benson-Manica | I *should* know what I'm talking about - if I
    ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
     
    Christopher Benson-Manica, Apr 30, 2004
    #2
    1. Advertisements

  3. LeTubs

    Karthik Guest

    LeTubs wrote:
    > Hi
    >


    IMHO, Most appropriate to comp.unix.programmer . Setting followup-to
    appropriately.

    HTH
     
    Karthik, Apr 30, 2004
    #3
  4. LeTubs wrote:

    > I'm not sure if this is correct ...place to post but here goes
    >
    > This is what I'm trying to do, I want to write a signal/alarm handler
    > (I don't know which hence the posting here,
    > as once I know the proper name/useage
    > then I'll use google to try and find out more information )....
    > Thus any tips or pointers would be helpful
    > (and I'm using a UNIX variant as OS)


    SIGNAL(2) Linux Programmer’s Manual SIGNAL(2)

    NAME
    signal - ANSI C signal handling

    SYNOPSIS
    #include <signal.h>

    typedef void (*sighandler_t)(int);

    sighandler_t signal(int signum, sighandler_t handler);

    DESCRIPTION
    The signal() system call installs a new signal handler
    for the signal with number signum.
    The signal handler is set to sighandler which may be
    a user specified function, or either SIG_IGN or SIG_DFL.

    Upon arrival of a signal with number signum,
    the following happens.
    If the corresponding handler is set to SIG_IGN,
    then the signal is ignored. If the handler is set to SIG_DFL,
    then the default action associated to the signal
    (see signal(7)) occurs. Finally,
    if the handler is set to a function sighandler,
    then first either the handler is reset to SIG_DFL
    or an implementation-dependent blocking of the signal
    is performed and next sighandler is called with argument signum.

    Using a signal handler function for a signal
    is called "catching the signal".
    The signals SIGKILL and SIGSTOP cannot be caught or ignored.

    RETURN VALUE
    The signal() function returns
    the previous value of the signal handler, or SIG_ERR on error.

    .
    .
    .

    CONFORMING TO
    ANSI C

    SEE ALSO
    kill(1), kill(2), killpg(2), pause(2), raise(3),
    sigaction(2), signal(7), sigsetops(3), sigvec(2), alarm(2)

    Linux 2.2 2000-04-28 SIGNAL(2)
     
    E. Robert Tisdale, Apr 30, 2004
    #4
    1. Advertisements

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. Ishwar Rattan

    timeout using alarm signal question??

    Ishwar Rattan, Jul 22, 2004, in forum: Python
    Replies:
    0
    Views:
    489
    Ishwar Rattan
    Jul 22, 2004
  2. Ishwar Rattan

    timeout on on socket using alarm signal??

    Ishwar Rattan, Jul 22, 2004, in forum: Python
    Replies:
    0
    Views:
    792
    Ishwar Rattan
    Jul 22, 2004
  3. Michael Pronath
    Replies:
    1
    Views:
    1,522
    Diez B. Roggisch
    Jan 3, 2005
  4. Replies:
    0
    Views:
    431
  5. Jp Calderone
    Replies:
    1
    Views:
    408
  6. Jack Orenstein

    threading.Thread vs. signal.signal

    Jack Orenstein, Sep 18, 2005, in forum: Python
    Replies:
    0
    Views:
    663
    Jack Orenstein
    Sep 18, 2005
  7. vj
    Replies:
    0
    Views:
    366
  8. Adrian Casey

    Using signal.alarm to terminate a thread

    Adrian Casey, Nov 13, 2006, in forum: Python
    Replies:
    7
    Views:
    816
    Nick Craig-Wood
    Nov 15, 2006
Loading...