signals

Java Swing application won't quit after recieving TERM signal

I have a Java Swing application that is being used as a cluster application. The problem is that every time the cluster tries to terminate the Java application, it just hangs and Windows displays the "End Now" dialog. The said application is a server type one so it spawns a thread for every attempt to connect to it is made. I learned th...

wxPython: Sending a signal to several widgets

I am not even sure how to ask this question. I want something that is like the wxPython event system, but a bit different. I'll try to explain. When there is a certain change in my program (a "tree change", never mind what that is,) I want to send a signal to all the widgets in my program, notifying them that a "tree change" has occurre...

Can I use POSIX signals in my Perl program to create event-driven programming?

Is there any POSIX signals that I could utilize in my Perl program to create event-driven programming? Currently, I have multi-process program that is able to cross communicate but my parent thread is only able to listen to listen at one child at a time. foreach (@proc) { sysread(${$_}{'read'}, my $line, 100); #problem here chomp($l...

POSIX threads and signals

I've been trying to understand the intricacies of how POSIX threads and POSIX signals interact. In particular, I'm interested in: What's the best way to control which thread a signal is delivered to (assuming it isn't fatal in the first place)? What is the best way to tell another thread (that might actually be busy) that the signal ha...

setitimer, SIGALRM & multithread process (linux, c)

Hello I want to use setitimer() (or alarm()) in multithreaded process in linux 2.6+ with NPTL-enabled libc. Which thread will receive sigalarm (SIGALRM) from kernel? Thanks. ...

determine pid of terminated process

I'm trying to figure out what the pid is of a process that sent the SIGCHLD signal, and I want to do this in a signal handler I created for SIGCHLD. How would I do this? I'm trying: int pid = waitpid(-1, NULL, WNOHANG); .. because I want to wait for any child process that is spawned. Thanks, Hristo ...

Problem with signal handlers

how can something print 3 times when it only goes the printing code twice? I'm coding in C and the code is in a SIGCHLD signal handler I created. void chld_signalHandler() { int pidadf = (int) getpid(); printf("pidafdfaddf: %d\n", pidadf); while (1) { int termChildPID = waitpid(-1, NULL, WNOHANG); if (termChildPID == 0 || term...

Proper way to relay signals across classes in qt4?

I have a QMainWindow which spawns a few wizards. The QMainWindow has a QFrame class that lists a collection of objects. I want to launch this window from within my wizard's QWizardPages. Basically, I need to connect a signal to a slot in the grand parent. The most obvious way to do this would be: MyMainWindow *mainWindow = qobject_cast...

Daubechies-4 Transform in MATLAB

Hello: I have a 4x4 matrix which I wish to decompose into 4 frequency bands (LL, HL, LH, HH where L=low, H=high) by using a one-level Daubechies-4 wavelet transform. As a result of the transform, each band should contain 2x2 coefficients. How can I do this in MATLAB? I know that MATLAB has dbaux and dbwavf functions. However, I'm not su...

QWebView loadFinished signal catching all responses even from different

Hello all im using one main QNetworkAccessManager that is in singleton class every time some part from the application that looks like this : NetWorkService::NetWorkService() { manager = new QNetworkAccessManager(); } QNetworkAccessManager* NetWorkService::getManager() { return manager; } needs to preform http call it call...

What is the best / proper idiom in django for modifying a field during a .save() where you need to old value?

Hi, say I've got: class LogModel(models.Model): message = models.CharField(max_length=512) class Assignment(models.Model): someperson = models.ForeignKey(SomeOtherModel) def save(self, *args, **kwargs): super(Assignment, self).save() old_person = #????? LogModel(message="%s is no longer assigned to ...

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

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. ...

nptl SIGCONT and thread scheduling

Hello, I'm trying to port a code that relies on SIGCONT to stop certain threads of an application. With current linux nptl implementation seems one can't rely on that in 2.6.x kernels. I'm trying to devise a method to stop other threads. Currently I can only think on mutexes and condition variables. Any hints is appreciated. ...

signal qt from a non-qt thread, QueuedConnection

hello, I am signaling my Qt GUI thread from a boost::thread, and I am using a Qt::QueuedConnection, connect(src, SIGNAL(signal-signature), dest, SLOT(slot-signature), Qt::QueuedConnection); and still, when I emit the signal my slot does not get called. edit: I found the problem, it seems that I was connecting the signal later then ...

Inject runtime exception to pthread sometime fails. How to fix that?

I try to inject the exception to thread using signals, but some times the exception is not get caught. For example the following code: void _sigthrow(int sig) { throw runtime_error(strsignal(sig)); } struct sigaction sigthrow = {{&_sigthrow}}; void* thread1(void*) { sigaction(SIGINT,&sigthrow,NULL); try { while(...

C signals and processes

Hi, so basically I want "cmd_limit" to take a number in seconds which is the maximum time we'll wait for the child process (safe to assume there's only one) to finish. If the child process does finish during the sleep, I want cmd_limit to return pass and not run the rest of the cmd_limit code. Could anyone help me do this, here's what I'...

C SIGSEGV Handler & Mprotect

I'm constructing a program which uses mprotect() to restrict a block of memory from accessing. When the memory is requested, a SIGSEGV is thrown which I listen for using a signal() call. Once the SIGSEGV has been detected, I need to somehow access the pointer to the memory that was requested (that threw the fault) and the size of the s...

Convolving two signals

Calculate the convolution of the following signals (your answer will be in the form of an equation): h[n] = [n-1] + [n+1], x[n] = [n-a] + [n+b] I'm lost as to what I do with h and x. Do I simply multiply them? h[n]*x[n]? I programmed convolution with several types of blurs and edge detectors, but I don't see how to translate that...

Why does the add() method in PHP-GTK cause 2 parent-set signals to be emmitted?

I am going through the book PHP-GTK and trying out listing 4-1 One thing I notice is that with the following code some odd output occurs: <?php //listing4-1b.php function setParentFunction($widget) { //get the widgets parent $parent = $widget->get_parent(); //echo a mssg about the widget echo 'The ' . get_class($wi...

Safe Cross Thread Signals/Slot C++

It seem that the only implementation that provide Safe Cross-Thread Signals for both the Signal class and what's being called in the slot is QT. (Maybe I'm wrong?). But I cannot use QT in the project I'm doing. So how could I provide safe Slots call from a different thread (Using Boost::signals2 for example)? Are mutex inside the slot ...