Skip to content
Advertisement

Tag: signals

C Programming – Counting signals in signal handler

I am working on signals in C programming. I have parent process and 5 child processes, I am trying to send SIGUSR2 from child processes to parent process when they are done some calculations while parent waits for them with sigsuspend(). When all 5 child processes sends SIGUSR2, parent process continues its work. I increment a global variable in the

Send a kill signal to self

I have a C++ code that runs a linux command, I want to simulate segfault i.e. SIGSEGV while executing that linux command from by C++ code. So my code looks like this What should I put in “cmd” so that it can send SIGSEGV to the sub-process created by calling this function? Answer Sending kill signal to self can by

C++ + linux handle SIGPIPE signal

Yes, I understand this issue has been discussed many times. And yes, I’ve seen and read these and other discussions: 1 2 3 and I still can’t fix my code myself. I am writing my own web server. In the next cycle, it listens on a socket, connects each new client and writes it to a vector. Into my class

Signals – SIGUSR1 class exercise

I got this as a class exercise. I had to analyze the output without running it and I figured that the output should be num=4. But actually the output of this code after running it is: I’ll be glad to know what am I missing? Answer This is an interesting question. So what’s happening is that a signal handler is

different ways to ignore a signal?

Im’ new to Linux and signal handling. the signal function prototype is below is my questions: Q1-if I want to ignore SIGINT signal, then I just need to simply code as: signal(SIGINT, SIG_IGN);, is my understanding corrct? Q2-What if I code as: since my own sigint_handler does nothing, it is pretty much like ignoring the SIGINT, so can I say

Advertisement