signals blocking

W

wongjoekmeu

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
 
S

santosh

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.programmer or comp.os.linux.development.apps or something
related.

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

Antoninus Twink

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top