signals

Trouble with boost signals

Hello, I have such situation in boost and C++: // Somewhere: typedef boost::signals2::signal<void (int KeyCode)> SigKeyPressed; typedef SigKeyPressed::slot_type SigKeyPressedType; class InputSystem { private: static SigKeyPressed mSigKeyPressed; public: static boost::signals2::connection keyPressed(const SigKeyPressed...

Why does using threading.Event result in SIGTERM not being caught?

I have a threaded Python daemon. Like any good daemon, it wants to launch all of its worker threads, then wait around until it's told to terminate. The normal signal for termination is SIGTERM, and in most languages I'd hold to terminate by waiting on an event or mutex, so using threading.Event made sense to me. The problem is that Pytho...

Signal - Slot connection inside loop

In my code I am creating new objects of same type inside loop and connecting a signal to object slot. Here is my trial. A * a; QList<A *> aList; int aCounter = 0; while(aCounter < 2) { a = new A; aList.push_back(a); connect(this,SIGNAL(somethingHappened()),aList[aCounter],SLOT(doSometing())); aCounter++; } When somethingH...

Django can you receive signals in middleware or alter the response object globally?

I'd like to call a function in my view or any module for that matter and have it update the response body. My initial thinking is to implement a process_response middleware to update the response body, and set up a callback that receives signals sent in my function calls, but when I try, the receiver never fires (I've tested the singal/...

What happens if during a signal handling in UNIX, the same signal gets sent to the program?

Any ideas on this? Is there some kind of a signal queue, or does it get dropped? While we are at this question, is it true that signal handlers should do as minimal work as possible? I read somewhere that a signal handler should use a pipe and just write one byte to it, indicating what the program should do. Then somewhere else the pro...

Problem compiling VS8 C++ program with boost signals

Hi there, So I am wanting to use boost signals in my C++ program. I add: #include <boost/signal.hpp> But I get this error when I build. fatal error LNK1104: cannot open file 'libboost_signals-vc90-mt-gd-1_42.lib' The lib file is not contained within my boost directory. Typing 'libboost_signal' (with variations) into google hasn'...

Explicitly invoke SIG_DFL/SIG_IGN handlers on Linux

I've blocked, and then waited for a signal via the following code: sigset_t set; sigfillset(&set); // all signals sigprocmask(SIG_SETMASK, &set, NULL); // block all signals siginfo_t info; int signum = sigwaitinfo(&set, &info); // wait for next signal struct sigaction act; sigaction(signum, NULL, &act); // get the current handler for th...

Under what circumstances are C++ destructors not going to be called?

I know that my destructors are called on normal unwind of stack and when exceptions are thrown, but not when exit() is called. Are there any other cases where my destructors are not going to get called? What about signals such as SIGINT or SIGSEGV? I presume that for SIGSEGV, they are not called, but for SIGNINT they are, how do I kno...

Deletion of objects send by signals, Ownership of objects in signals, Qt

Here, my signal declaration: signals: void mySignal(MyClass *); And how I'm using it: MyClass *myObject=new myClass(); emit mySignal(myObject); Here comes my problem: Who is responsible for deletion of myObject: 1-)Sender code, what if it deletes before myObject is used? Dangling Pointer 2-)The slot connected to signal, what ...

Python signals hosted on WSGI

I'm using the python signals library to kill a function if it runs longer than a set period of time. It works well in my tests but when hosted on the server I get the following error "signal only works in main thread" I have set the WSGI signals restriction to be off in my httpd.conf WSGIRestrictSignal Off as described http://code....

Should I be worried about the order, in which processes in a process goup receive signals?

I want to terminate a process group by sending SIGTERM to processes within it. This can be accomplished via the kill command, but the manuals I found provide few details about how exactly it works: int kill(pid_t pid, int sig); ... If pid is less than -1, then sig is sent to every process in the process group whose ID is ...

Starting a process over ssh using bash and then killing it on sigint

I want to start a couple of jobs on different machines using ssh. If the user then interrupts the main script I want to shut down all the jobs gracefully. Here is a short example of what I'm trying to do: #!/bin/bash trap "aborted" SIGINT SIGTERM aborted() { kill -SIGTERM $bash2_pid exit } ssh -t remote_machine /foo/bar.sh & b...

PyQt4: Sending a custom signal from a thread to a progress dialog

Hi, I am unable to send a signal updating a progress dialog from a QThread. I set up the thing like this (from within the MainWindow class): self.progressDialog = QtGui.QProgressDialog("Packing ...", QtCore.QString(), 0,100, self.parent_) self.thread = QtCore.QThread(parent = self.parent_) self.thread.run = myRun self.thread.start() se...

django: recursion using post-save signal

Here's the situation: Let's say I have a model A in django. When I'm saving an object (of class A) I need to save it's fields into all other objects of this class. I mean I need every other A object to be copy of lat saved one. When I use signals (post-save for example) I get a recursion (objects try to save each other I guess) and my...

Why doesnt SIGINT get caught here?

Whats going on here? I thought SIGINT would be sent to the foreground process group. (I think, maybe, that system() is running a shell which is creating a new process group for the child process? Can anyone confirm this?) % perl local $SIG{INT} = sub { print "caught signal\n"; }; system('sleep', '10'); Then hit ctrl+d then ctrl+c im...

Using Qt signals and slots with multiple inheritance

I have a class (MyClass) that inherits most of its functionality from a Qt built-in object (QGraphicsTextItem). QGraphicsTextItem inherits indirectly from QObject. MyClass also implements an interface, MyInterface. class MyClass : public QGraphicsTextItem, public MyInterface I need to be able to use connect and disconnect on MyInterfa...

Django error 'Signal' object has no attribute 'save'

I've been struggling with this problem for 5 hours and I have a feeling it's a simple solution that I'm just overlooking. I'm trying to tie in a third party module (Django Activity Stream) that uses a series of senders and receivers to post data about user activity to a database table. Everything is set up and installed correctly, but I...

Operating System Implementation of events/signals/wait handles

Out of curiousity I was wondering how Operating Systems implement waking threads that are waiting on events/handles etc. For example say an OS thread continually scans through a list of wait handles and executes the respective threads if necessary. Not that I believe its implemented this way as it would seem inefficient. I think its m...

terminate script of another user

On a linux box I've got a python script that's always started from predefined user. It may take a while for it to finish so I want to allow other users to stop it from the web. Using kill fails with Operation not permitted. Can I somehow modify my long running python script so that it'll recive a signal from another user? Obviously, t...

Coming back to life after Segmentation Violation

Is it possible to restore the normal execution flow of a C program, after the Segmentation Fault error? struct A { int x; }; A* a = 0; a->x = 123; // this is where segmentation violation occurs // after handling the error I want to get back here: printf("normal execution"); // the rest of my source code.... I want a mechanism s...