signals blocking

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • wongjoekmeu@yahoo.com

    signals blocking

    Dear All,
    I have some a program in which I link a static library. The static
    library has a initialize() and uninitialized() function.
    Now when I call the initialize function a thread is being started up
    and it makes use of the linux timer and start sending signals in a
    certain frequency. This is a problem as when I use the getch()
    function I see that something is being written continuously to the
    console, which is not a satisfactory behavior for my program as in the
    program I want to ask the user for certain inputs. I am not familiar
    with signals in C but I was wondering if there is anyway to block
    those signals.
    Many thanks in advance for trying to answer my question.

    RR
  • santosh

    #2
    Re: signals blocking

    wongjoekmeu@yah oo.com wrote:
    Dear All,
    I have some a program in which I link a static library. The static
    library has a initialize() and uninitialized() function.
    Now when I call the initialize function a thread is being started up
    and it makes use of the linux timer and start sending signals in a
    certain frequency. This is a problem as when I use the getch()
    function I see that something is being written continuously to the
    console, which is not a satisfactory behavior for my program as in the
    program I want to ask the user for certain inputs. I am not familiar
    with signals in C but I was wondering if there is anyway to block
    those signals.
    Many thanks in advance for trying to answer my question.
    This is a question which cannot be satisfactorily answered without more
    details. Which signal is being sent to the program? Is there a handler
    for the signal? What behaviour does the program currently exhibit? Are
    you sure it's the signal that's responsible for writing something to
    the console? And what exactly is being written?

    Also just about any use of signal requires varying amounts of
    implementation specific support and guarantees, which means that your
    question (with appropriate details and sample code if possible) is
    better posted to a group specific to your system like
    comp.unix.progr ammer or comp.os.linux.d evelopment.apps or something
    related.

    Even otherwise more details are needed before anything useful can be
    said.

    Comment

    • Antoninus Twink

      #3
      Re: signals blocking

      On 22 Apr 2008 at 16:13, wongjoekmeu@yah oo.com wrote:
      I have some a program in which I link a static library. The static
      library has a initialize() and uninitialized() function.
      Now when I call the initialize function a thread is being started up
      and it makes use of the linux timer and start sending signals in a
      certain frequency. This is a problem as when I use the getch()
      function I see that something is being written continuously to the
      console, which is not a satisfactory behavior for my program as in the
      program I want to ask the user for certain inputs. I am not familiar
      with signals in C but I was wondering if there is anyway to block
      those signals.
      If you really mean that the thread is sending SIGALRM signals to your
      process, then yes, you can block them by changing the disposition for
      this signal to ignore:

      #include <signal.h>

      signal(SIGALRM, SIG_IGN);

      (Blocking the signal on a per-thread basis is more complicated: you need
      to use sigaction() and alter the signal mask. Ask if you want details of
      that.)

      However, you probably don't want to do that: it's quite likely that the
      library isn't just pointlessly sending signals to your process: it will
      have installed a signal handler and be doing something useful in the
      handler function. Unfortunately, it also seems to be doing non-useful
      things, like writing junk to stdout or stderr. There's not much you can
      do about that except looking for a "quiet" or "silent" option you can
      give the library.

      Comment

      Working...