473,806 Members | 2,739 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Jun 27 '08 #1
2 1565
wo*********@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.

Jun 27 '08 #2
On 22 Apr 2008 at 16:13, wo*********@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.

Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6100
by: Isidro Vila Verde | last post by:
Greetings, I need to handle signals to close some excel applications that my script open, when the script is killed by another process. My script is a little bit complex, but I wrote just two very small scripts to test the kill and signal. The scripts signal.pl is this one: map {$SIG{$_} = sub {my $n = shift; print "n=$n\n"}} keys %SIG;
4
16314
by: Gabriele Bartolini | last post by:
Hi, I am writing an application in C++ on Linux, using threads (this is my first experience with pthreads). The application itself is fine, it is just that I wanted to handle asynchronous signals correctly, in particular the SIGINT, preventing the application from stopping ungracefully. Indeed, I'd like to catch the signal, close everything in a consistent way and stop the application.
1
1659
by: Leo Kirch | last post by:
Hello XSLT gurus, i've got a rather difficult problem. Some explanations first. theres a signal oriented xml-file - the graphical represantation looks like: | startsignal (signal00) \ / ---------------------------------------------------------
4
6918
by: maxmagna | last post by:
Hello, I am looking for material that describes how *precisely* UNIX-based signals interact with the normal C++ execution flow of control and guidelines on how to treat signals in an "object-oriented style". So far I have not been able to locate much on the subject. Can anyone provide any pointer/information or suggestion? Thanks, max
4
1267
by: bill | last post by:
I see this (or similar) question occasionally looking back through the archive, but haven't yet seen a definitive answer, so I'm going to ask it again. Consider the following: while True: do_something_to_files_in_directory(fd) fcntl(fd, F_NOTFIY, DN_CREATE) signal.pause()
0
1946
by: Arnaud Debaene | last post by:
Hello all. I've got a bunch of existing, non managed, C++ DLLs that export types with, among other things, public events implemented using the boost::signals library. Now, I need to have these DLL interoperate with managed code. Among others things, the managed code need to be able to register for notification with the boost signals. I've tried different approaches (trying to register a pinned delegate with the boost::signal, etc...),
6
2386
by: geoffbache | last post by:
Hi all, I have a Python program (on UNIX) whose main job is to listen on a socket, for which I use the SocketServer module. However, I would also like it to be sensitive to signals received, which it isn't if it's listening on the socket. ("signals can only be received between atomic actions of the python interpreter", presumably - and control will not return to Python unless something appears on the socket). Does anyone have a tip of a...
11
1843
by: vippstar | last post by:
What is the purpose of signals and why do they exist in C? thanks in advance
0
1405
by: Tim Golden | last post by:
Lowell Alleman wrote: Well you've certainly picked a ticklish area to run into problems with ;). First, forget about the threading aspects for the moment. AFAICT the smallest program which reproduces your problem is: <code> import signal
0
9719
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9598
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10623
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10111
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9192
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5683
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3852
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3010
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.