signals

Qt5 new signal to lambda connections memory leak

人盡茶涼 提交于 2019-12-30 05:35:07
问题 The new Qt5 signals and slots syntax allows us to connect signals not only to slots, but also to plain old functions and functors/lambdas. Now the problem is, that lambdas are essentialy objects with () operator, and when you connect signals to them, they get copied somewhere in qt internal classes. And, when you disconnect the signal from that functor, it stays in qt internals. I fail to understand, is that a normal behaviour? Or maybe there is a way to destroy those functional objects after

Will ctrl+c send SIGINT signals to both parent and child processes in Linux?

回眸只為那壹抹淺笑 提交于 2019-12-30 05:17:25
问题 In the terminal, I executed a main parent process which will fork a child process. In both the parent and child processes I implemented a SIGINT signal handler. So when I press "ctrl+c", will both the handlers be called at the same time? Or do I need to call the child process's signal handler explicitly in the parent process's handler? I looked up this post: How does Ctrl-C terminate a child process? which says that " The SIGINT signal is generated by the terminal line discipline, and

Signals and interrupts a comparison

我们两清 提交于 2019-12-29 10:05:51
问题 Based on various references, my subjective definition of signals in Linux is "The triggers that are used to notify the processes about an occurrence of a specific event.Event here may refer to a software exception.Additionally signals may also be used for IPC mechanisms." The questions I have are I presume only exceptions (software interrupts) are notified via signals.What about the case of hardware interrupts. What are the various sources of the signal? To me it looks like kernel is always

MySQL: Unable to use SIGNAL in Trigger

让人想犯罪 __ 提交于 2019-12-29 08:04:11
问题 I am trying to generate an error message using the MySQL trigger. Below is my code: DELIMITER $$ CREATE TRIGGER `test_before_insert` BEFORE INSERT ON `Initial_Fees` FOR EACH ROW BEGIN IF ((SELECT Activation from Portfolio WHERE idPortfolio = New.idPortfolio)=false) THEN SIGNAL SQLSTATE '45000'; SET MESSAGE_TEXT := 'Disabled Thing'; END IF; END$$ DELIMITER ; But this always generates an error. I don't know what the error is, because It is not saying anything about the error, it is just "Error"

do actions on end of execution

前提是你 提交于 2019-12-29 00:35:33
问题 I have an http server (launched using http.Handle ) and I would like to do some operations. How can I do that (on linux) ? Is it possible to do those operations in case of a ctrl-C ? I'm not familiar with unix signals so the answer may be trivial. 回答1: You can subscribe to the TERM and INT signals using the signal package. But note that these signals are only sent when the process is killed explicitly; normal exit (initiated by the process itself) does not involve any sort of signals. I think

do actions on end of execution

浪尽此生 提交于 2019-12-29 00:35:04
问题 I have an http server (launched using http.Handle ) and I would like to do some operations. How can I do that (on linux) ? Is it possible to do those operations in case of a ctrl-C ? I'm not familiar with unix signals so the answer may be trivial. 回答1: You can subscribe to the TERM and INT signals using the signal package. But note that these signals are only sent when the process is killed explicitly; normal exit (initiated by the process itself) does not involve any sort of signals. I think

Printf is not working in C signal handler

怎甘沉沦 提交于 2019-12-28 03:08:46
问题 Code in question first (minimized case): #include <stdio.h> #include <signal.h> int counter = 0; void react_to_signal(int n) { fprintf(stderr, "Caught!\n"); counter++; } int main(int argc, char** argv) { signal(SIGINFO, react_to_signal); while (1) { printf("%d\n", counter); } return 0; } I run the code, it loops as it should, printing out 0. Then in another shell.. kill -s SIGINFO <pid_of_my_process> Signal is delivered, c is incremented .. but the fprintf doesn't happen. Why is this so? In

Printf is not working in C signal handler

混江龙づ霸主 提交于 2019-12-28 03:08:05
问题 Code in question first (minimized case): #include <stdio.h> #include <signal.h> int counter = 0; void react_to_signal(int n) { fprintf(stderr, "Caught!\n"); counter++; } int main(int argc, char** argv) { signal(SIGINFO, react_to_signal); while (1) { printf("%d\n", counter); } return 0; } I run the code, it loops as it should, printing out 0. Then in another shell.. kill -s SIGINFO <pid_of_my_process> Signal is delivered, c is incremented .. but the fprintf doesn't happen. Why is this so? In

C fork and pipe program with non-deterministic output

一笑奈何 提交于 2019-12-25 18:19:53
问题 Lets consider the following code (please do not write, that there are naming problems, structuring problems, etc, I know this, too). It was written to write out the random generated x,y,z and r (and pid) numbers for its 3 children, but it often happens that it only prints two/one "Got this..." lines, and I dont know, why. Could you please explain me, what the problem is, or correct my code? #include <stdlib.h> #include <stdio.h> #include <sys/types.h> //fork #include <sys/stat.h> #include

QTableView with QStandardItemModel: How to perform live updates during editing a cell?

假如想象 提交于 2019-12-25 17:10:13
问题 Recently, I made the switch to QT. It has taken some time, but I am starting to find my way around. However, one issue remains: I want to port a program, that responds to every key press while editing a cell in a table view (QTableView with QStandardItemModel). The idea is to show and update a list of possibilities on a separate form while the user is entering a text in a table view's cell. After every key stroke, the list needs to be updated according to the current text in the edit field of