signals

What happens when a signal is received while already in a signal handler?

邮差的信 提交于 2019-12-03 13:15:11
I have a parent process spanning several child processes. I want to know when any child process exits by registering a SIGCHLD signal handler. The question is, what happens if another SIGCHLD (or any other signal) is received, while the parent process is already in a signal handler? I can think of the following outcomes: The signal is ignored The signal is queued, and will be processed as soon as the current handler returns The current handler is in turn interrupted, just like the main program Which one is correct? In your concrete example (the same signal being received), the signal is

Converting floating point exceptions into C++ exceptions

家住魔仙堡 提交于 2019-12-03 13:13:28
问题 Is it possible to convert floating point exceptions (signals) into C++ exceptions on x86 Linux? This is for debugging purposes, so nonportability and imperfection is okay (e.g., if it isn't 100% guaranteed that all destructors are called). 回答1: If your C++ standard library implementation supports the TR1 functions fetestexcept , feraiseexcept and feclearexcept (mine doesn't yet so I can't test this) you can detect five kinds of floating point errors and then you can throw whatever exceptions

How to use templates with QT signals and slots?

 ̄綄美尐妖づ 提交于 2019-12-03 13:12:49
I want to use signals and slots in my program, but unfortunately they should be used for transmitting several different data types (e.g. QString, double, etc.) and I don't want to write twenty different slots just because I need one for each data type. But when I want to declare a slot like template <typename t> void Slot1(t data); QT tells me that it is not possible to use templates in signals and slots. Is there a workaround? Or can my approach simply improved? Accurate answer: It is impossible Workaround: You can do something like this with new signals and slots syntax: QSlider *slid = new

Similarity between two signals: looking for simple measure

跟風遠走 提交于 2019-12-03 13:08:12
问题 I have 20 signals (time-courses) in group A and 20 signals in group B. I want to find a measure to show that group A is different from group B. For example, I ran xcorr for the signals within each group. But now I need to compare them somehow. I tried to take a maximal amplitude of each xcorr pair, which is sort a measure of maximal similarity. Then I compared all these values between two groups, but there was no difference. What else can I do? I can also compare frequency spectrum, but then

How to intercept EXC_BAD_INSTRUCTION when unwrapping Nil

拟墨画扇 提交于 2019-12-03 12:55:49
问题 I am building some rudimentary crash logging system based on this blog post ( Yes , I am aware of PLCRashReporter, and No , I can't use it and need to roll my own, however limited. Thank you). My code registers both an exception handler (with NSSetUncaughtExceptionHandler() ) and a signal handler for most signals: SIGQUIT SIGILL SIGTRAP SIGABRT SIGEMT SIGFPE SIGBUS SIGSEGV SIGSYS SIGPIPE SIGALRM SIGXCPU SIGXFSZ It seems to work fine with basic Objective-C stuff such as "unrecognized selector

Why I am not getting signal SIGKILL on kill -9 command in bash?

眉间皱痕 提交于 2019-12-03 12:43:14
In bash script I handle different signal as follows: #!/bin/bash sighdl () { echo "signal caught" #do something exit 0 } trap sighdl SIGKILL SIGINT SIGTERM Above code handle signal properly for following activity: Ctrl + C kill pid pkill scriptname For kill -9 pid it does not call sighdl . As per my understanding (if I am not wrong) kill -9 sends the SIGKILL signal. Any idea? You cannot do that. Yes 9 is SIGKILL and Unix system by design doesn't allow any script/program to trap SIGKILL due to security reasons. Otherwise any script can trap & ignore SIGKILL which will make impossible to

How can I tell unicorn to understand Heroku's signals?

雨燕双飞 提交于 2019-12-03 12:27:11
Perhaps you've seen this... 2012-03-07T15:36:25+00:00 heroku[web.1]: Stopping process with SIGTERM 2012-03-07T15:36:36+00:00 heroku[web.1]: Stopping process with SIGKILL 2012-03-07T15:36:36+00:00 heroku[web.1]: Error R12 (Exit timeout) -> Process failed to exit within 10 seconds of SIGTERM 2012-03-07T15:36:38+00:00 heroku[web.1]: Process exited with status 137 This is a well known problem when running unicorn on heroku ... heroku uses SIGTERM for graceful shutdown unicorn uses SIGTERM for quick shutdown Can I tell heroku to send SIGQUIT ? Or can I tell unicorn to treat SIGTERM as graceful

Elegant way to disconnect slot after first call

回眸只為那壹抹淺笑 提交于 2019-12-03 12:24:04
Inside the constructor, there is a connection: connect(&amskspace::on_board_computer_model::self(), SIGNAL(camera_status_changed(const amskspace::camera_status_t&)), this, SLOT(set_camera_status(const amskspace::camera_status_t&))); And the method: void camera_model:: set_camera_status(const amskspace::camera_status_t& status) { disconnect(&amskspace::on_board_computer_model::self(), SIGNAL(camera_status_changed(const amskspace::camera_status_t&)), this, SLOT(set_camera_status(const amskspace::camera_status_t&))); // do the job } And I'd like to disconnect this slot after the first call. The

Linux blocking signals to Python init

北城以北 提交于 2019-12-03 12:21:25
This is a follow up to my other post Installing signal handler with Python . In short, Linux blocks all signals to PID 1 (including SIGKILL) unless Init has installed a signal handler for a particular signal; as to prevent kernel panic if someone were to send a termination signal to PID1. The issue I've been having, is it would seem that the signal module in Python doesn't install signal handlers in a way the system recognises. My Python Init script was seemingly, completely ignoring all signals as I think they were being blocked. I seem to have found a solution; using ctypes to install the

Erlang Linux signal handling

风流意气都作罢 提交于 2019-12-03 12:20:04
问题 Is it possible to trap Linux signals (e.g. SIGUSR1) through an handler in Erlang? (without having to resort to a driver crafted in C) 回答1: (NOT A REAL ANSWER) In 2001 someone asked: Does anyone have any examples of unix signal handling in erlang. I would like to make a loadbalancer that I have written respond to sighup. At that time the answer was: There is no provision for handling signals in Erlang "itself", i.e. you will need to use a driver - or a port program of course, might actually be