Questions tagged [signal-handling]

In the C Standard Library, signal processing defines how a program handles various signals while it executes. A signal can report some exceptional behavior within the program (such as division by zero), or a signal can report some asynchronous event outside the program (such as someone striking an interactive attention key on a keyboard).

290 questions
0
votes
1 answer

Reading from shared resource inside signalhandler

I have a shared resource representing request stats for a web server which forks after an accept call to process client connections. I'd like to print these stats to stderr when a certain signal is caught by the parent process, however the stats…
usddddd
  • 66
  • 5
0
votes
2 answers

signature of signal handling function in c

I am using the open signals SIGUSR1 and SIGUSR2 to call a user-defined function. I have tried two function prototype for my signal handling function. Both of which runs without any compilation error. What exactly happens when open signals call a…
sudeepdino008
  • 3,194
  • 5
  • 39
  • 73
0
votes
1 answer

Correct syntax for signal handlers?

I've searched among the documentation of Python, and PyGtk but i couldn't find the right syntax for a generic signal handler written by the programmer; i've just found the documentation for the classic API provided by the library(PyGtk). This is the…
FrancescoN
  • 2,146
  • 12
  • 34
  • 45
0
votes
2 answers

Handling CTRL-C in dummy shell

I'm writing a dummy shell that should not terminate when the user types ctrl-C but should just generate a new prompt line. Currently, my shell does not terminate when I type ctrl-C but it still does not print the new prompt line. Do you know why…
user2264035
  • 565
  • 1
  • 7
  • 13
0
votes
1 answer

How to use signals properly in C?

I have to write a program called BuzzOff.c. My program has to take in 3 integer arguments as such: $ BuzzOff 10 99999 2 My program should quietly count from 0 to by 0.001 increments and keep a running total of the resulting product of and the…
user2264035
  • 565
  • 1
  • 7
  • 13
0
votes
2 answers

Parent process is firing signals at a child process but the child's signal handling needs to be improved

I'm doing some practice questions for an exam and one of the questions gives two pieces of code called parent.c and child.c . Parent creates a child and fires signals at it and child displays a message every time it receives a signal. Child will…
user1786327
  • 43
  • 1
  • 4
0
votes
1 answer

CPU killed by SIGXCPU using OpenCL and mono

I have got very similar problem to this one stated here : Intel CPU OpenCL in Mono killed by SIGXCPU (Ubuntu) Essentially, I have a very simple C# application using OpenCL (through OpenCL.Net wrapper, but it shouldn't make a difference as it is…
kudkudak
  • 496
  • 3
  • 7
0
votes
1 answer

Save variable returned by signal handler?

I am writing an application in Python 2.7 using PyGTK 2. Basically I create TreeView widget, fill it with content and then check if the selection is changed. When it is true I want the selection to be printed in TextView box. My idea is to get…
Sayid
  • 1,083
  • 2
  • 10
  • 21
0
votes
2 answers

Test unit in C for server listening function. Avoid listen blocking call

I am writing a test unit for function named pkg_getclient (). It is, basically, a function that listens indefinetly for a client. Here is the implementation : http://slexy.org/view/s21RBuOUOu (pasted there to keep question text size reasonable…
pAndrei
  • 383
  • 6
  • 19
0
votes
3 answers

How to handle signals/events in Java

Can any tell me how signals are handled in Java? I have a situation where I need to signal an event/signal to a thread from application main ().
Rajesh SO
  • 183
  • 1
  • 3
  • 16
0
votes
1 answer

using signal handler for ctrl-c - need help on infinite loops

I am using signal handler for ctrl-c signal. i.e whenever ctrl-c signal is generated instead of exiting the application I do some action. Let us suppose if my application hangs due to while(1) loop (any error condition) is it possible for me to…
user1225606
  • 1,123
  • 2
  • 14
  • 14
-1
votes
2 answers

Signal Handling (c++)

I have this simple code that loops the word "SIGNALS ARE COOL" I'm trying to make it take signals like (SIGFPE. SIGABRT, SIGINT, SIGSEGV.) and show the signal type and the time I made this code that takes "SIGINT" signal how do I add more signals…
Hade Zedan
  • 21
  • 2
-1
votes
1 answer

signal handler ending the process after its execution

I'm coding a program and I settled up a signal handler for SIGINT: volatile int exit_program = 0; //Global variable void exit_client() { write(1, "Disconnecting...\n", strlen("Disconnecting...\n")); exit_program = 1; } Then in main I told…
user157629
  • 624
  • 4
  • 17
-1
votes
1 answer

handle ctrl+c in client-server socket in c programing

I wrote a telnet server in C programing language. Clients connect to the server using this command : telnet *IP_Address* I want when a client presses ctrl+c in its teminal, server closes the client connection but the server socket remains open. To…
f_y
  • 73
  • 9
-1
votes
1 answer

Deadlock while multi-threaded process exit in signal handler

There are two thread in a process. when main thread receive SEGV, from signal handler i used to send some internal signal to other auxiliary thread using pthread_kill and using this internal signal i used to trap auxiliary thread in sleep state, so…
1 2 3
19
20