signals

How to make lldb ignore EXC_BAD_ACCESS exception?

狂风中的少年 提交于 2019-12-03 14:41:09
问题 I am writing a program on Mac OSX depending on the sigaction/sa_handler mechanism. Run a code snippet from user and get ready to catch signals/exceptions at any time. The program works fine, but the problem is I can't debug it with lldb. lldb seems not being able to ignore any exceptions even I set proc hand -p true -s false SIGSEGV proc hand -p true -s false SIGBUS The control flow stops at the instruction that triggers the exception and does not jump to the sa_handler I installed earlier

how to pass qobject as argument from signal to slot in qt connect

你。 提交于 2019-12-03 14:28:00
问题 My original code passed a QStringList from the signal to the slot and then returned a QList. Everything worked fine but I needed to change both the QStringList and QList into 2 different subclassed QObjects. Since then I have been receiving errors like "synthesized method first required here" or it simply crashes without any error message. I understand that qt copies all arguments passed in a queued connection and a qobject cannot be copied. So instead of returning a qobject I thought I would

celery trying shutdown worker by raising SystemExit in task_postrun signal but always hangs and the main process never exits

亡梦爱人 提交于 2019-12-03 14:16:07
I'm trying to shutdown the main celery process by raisin SystemExit() in the task_postrun signal. The signal gets fired just fine, and the exception gets raised, but the worker never completely exits and just hangs there. HOW DO I MAKE THIS WORK? Am I forgetting some setting somewhere? Below is the code that I'm using for the worker (worker.py): from celery import Celery from celery import signals app = Celery('tasks', set_as_current = True, broker='amqp://guest@localhost//', backend="mongodb://localhost//", ) app.config_from_object({ "CELERYD_MAX_TASKS_PER_CHILD": 1, "CELERYD_POOL": "solo",

Is there a C++ cross platform “named event like the ”CreateEvent()\" in Win32?

血红的双手。 提交于 2019-12-03 14:00:20
I am looking for something analogous to CreateEvent(), SetEvent() and WaitForMultipleObjects() from the Win32 world. Specifically this has to be accessible across processes on the same machine. We are already using Poco for some cross platform stuff, but I don't see that the Poco::Event is what I want. perhaps i am missing something. EDIT: To explain what I want to do: I want process B to know when something happens in process A. This is trivial in win32 - Each process/thread calls CreateEvent() with a name for the event. Process B calls waitForXObject() and Process A calls SetEvent() when

Why Linux always output “^C” upon pressing of Ctrl+C?

耗尽温柔 提交于 2019-12-03 13:54:26
I have been studying signals in Linux. And I've done a test program to capture SIGINT. #include <unistd.h> #include <signal.h> #include <iostream> void signal_handler(int signal_no); int main() { signal(SIGINT, signal_handler); for (int i = 0; i < 10; ++i) { std::cout << "I'm sleeping..." << std::endl; unsigned int one_ms = 1000; usleep(200* one_ms); } return 0; } void signal_handler(int signal_no) { if (signal_no == SIGINT) std::cout << "Oops, you pressed Ctrl+C!\n"; return; } While the output looks like this: I'm sleeping... I'm sleeping... ^COops, you pressed Ctrl+C! I'm sleeping... I'm

Which “fatal” signals should a user-level program catch?

ε祈祈猫儿з 提交于 2019-12-03 13:48:54
First of all, I do know that there was a similar question here in the past . But that question wasn't answered properly. Instead, it diverted into suggestion what to do to catch signals. So just to clarify: I've done whatever needs to be done to handle signals. I have an application that forks a daemon that monitors the main process through pipe. If a main process crashes (e.g. segmentation fault), it has a signal handler that writes all the required info to pipe and aborts. The goal is to have as much info as possible when something bad happens to the application , w/o messing with "normal"

Explain void (*signal(int signo, void *(func)(int)))(int)

自闭症网瘾萝莉.ら 提交于 2019-12-03 13:48:54
问题 Please explain this type signature : void (*signal(int signo, void *(func)(int)))(int) 回答1: The type signature of the signal function is a bit more clear when a typedef is used for the function pointers that are passed around: typedef void (*sighandler_t)(int); sighandler_t signal(int signo, sighandler_t func); sighandler_t is a pointer to a function that takes an int parameter and returns nothing. The signal function takes such a function pointer as its second parameter. It also returns a

Threading and Signals problem in PyQt

好久不见. 提交于 2019-12-03 13:36:13
问题 I'm having some problems with communicating between Threads in PyQt. I'm using signals to communicate between two threads, a Sender and a Listener. The sender sends messages, which are expected to be received by the listener. However, no messages are receieved. Can anyone suggest what might be going wrong? I'm sure it must be something simple, but I've been looking around for hours and not found anything. Thanks in advance! from PyQt4 import QtCore,QtGui import time class Listener(QtCore

multi-threaded signal handling

馋奶兔 提交于 2019-12-03 13:31:15
问题 In unix, If a multi-threaded process was sent a signal, which thread will be the one to execute the handling function? if it is a multi-cpu machine, more than 1 thread is running at the same time. which thread will be the on to run the signal handling function? 回答1: According to man 7 signal, all threads in the process share the same signal handler, and if a signal is delivered to a process with multiple threads that have not blocked the signal, one of them is arbitrarily chosen to receive it

Terminating multithreaded application in C++11 by POSIX signal

半城伤御伤魂 提交于 2019-12-03 13:24:45
I wrote a simple multithreaded application in C++11 on Linux platform and I would like to terminate the server and its running threads by sending SIGINT signal. Obviously my server application uses thread support from C++11 ( std::thread etc.). Although I found some support for signal handling in C++11 ( std::signal ), I couldn't find any support for handling signals in multithreaded environment. So my question is - is there any way how to handle signals in multithreaded application in C++11 or do I have to rely back on pthreads just because my application needs to deal with signals? 2.4