Hi everyone,
First off, I know that this has been discussed before and I did a
search but could not find anything that helped my situation.
Here is the problem: I have a Python program that uses threads, forked
processes, and signals and I can't seem to understand where the signals
go.
When the program starts, it creates a thread, which spins in select
until and event is set. After the thread is spawned, the main thread
goes on to created several child processes (using os.fork and
os.execvp) and then it joins the spinning thread. The main thread sets
a signal handler for SIGINT (Ctrl-C) before it joins the spinning
thread.
The problem that I am experiencing is that when SIGINT is sent to the
program, it gets delivered to the child processes (the fork'ed ones)
but the main thread's signal handler is never invoked.
I know that Python masks signals in threads but they should be fine in
the main thread and that is where they should get delivered.
Any insight into this problem would be appreciated?
--
-- Mitko 0 1009 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sebastian Meyer |
last post by:
Hi Newsgroup,
i have some problems with using threads and signals in one program.
In my program i have three threads running, one for checking a directory
at a specified interval to see if new data arrived, one waiting for work
and the main thread.
My problem is the following:
I want to shutdown the program via a signal, so i used the signal module.
I know, that signal handling mus be done by the main thread, the signal
|
by: Holger Joukl |
last post by:
Hi,
migrating from good old python 1.5.2 to python 2.3, I have a problem
running a program that features some threads which execute calls to
an extension module.
Problem is that all of a sudden, I cannot stop the program with a keyboard
interrupt any more; the installed signal handler does not seem to receive
the signal at all.
This happens both if I rebuild this extension using python 2.3
headers/library
and if I simply use the old...
|
by: Frank Bossy |
last post by:
Dear group :)
I don't quite understand the meaning of this paragraph in the qt docu
(http://doc.trolltech.com/3.1/threads.html):
***SNIP
The Signals and Slots mechanism can be used in separate threads, as
long as the rules for QObject based classes are followed. The Signals
and Slots mechanism is synchronous: when a signal is emitted, all
slots are called immediately. The slots are executed in the thread
|
by: Gabriele Bartolini |
last post by:
Hi,
I am writing an application in C++ on Linux, using threads (this is
my first experience with pthreads). The application itself is fine, it
is just that I wanted to handle asynchronous signals correctly, in
particular the SIGINT, preventing the application from stopping
ungracefully.
Indeed, I'd like to catch the signal, close everything in a
consistent way and stop the application.
|
by: Jackie |
last post by:
Hi everyone,
I'd like to know when and how signals are used (e.g. SIGFPE, SIGABRT,
SIGTERM, SIGSEGV, SIGINT)? Thank you so much.
| |
by: Chad J. Schroeder |
last post by:
I've run into an "opportunity" in a Python application using threads and
signals.
Basically, there is a main process that spawns off a child thread that loops
forever.
In between iterations, the child thread sleeps for X seconds. All the while, the
main
thread loops forever doing its thing and also sleeps in between iterations (see
the code
at the end this message). Normally the application would be daemonized before
the main
|
by: Lloyd Zusman |
last post by:
I have a python-2.5 program running under linux in which I spawn a
number of threads. The main thread does nothing while these subsidiary
threads are running, and after they all complete, the main thread will
then exit.
I know that I can manage this through the use of Thread.join(), but
when I do it as follows, the main thread doesn't respond to signals:
import sys, time, signal, threading
|
by: geoffbache |
last post by:
Hi all,
I have a Python program (on UNIX) whose main job is to listen on a
socket, for which I use the SocketServer module. However, I would also
like it to be sensitive to signals received, which it isn't if it's
listening on the socket. ("signals can only be received between atomic
actions of the python interpreter", presumably - and control will not
return to Python unless something appears on the socket). Does anyone
have a tip of a...
|
by: vippstar |
last post by:
What is the purpose of signals and why do they exist in C?
thanks in advance
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |