Pausing a process?
By using psutil ( https://github.com/giampaolo/psutil ): >>> import psutil >>> somepid = 1023 >>> p = psutil.Process(somepid) >>> p.suspend() >>> p.resume()
By using psutil ( https://github.com/giampaolo/psutil ): >>> import psutil >>> somepid = 1023 >>> p = psutil.Process(somepid) >>> p.suspend() >>> p.resume()
I was able to reproduce the behavior you report. My hypothesis is that since the script is running from a non-interactive shell (as a child of a script) that SIGINT, which is a keyboard signal, is ignored. From info bash: Background processes are those whose process group ID differs from the terminal’s; such processes are … Read more
Figured it out. I have to ignore any SIGTTOU signals. I did that by adding: signal(SIGTTOU, SIG_IGN); Before the tcsetpgrp() call.
This is an example Qt application demonstrating sending signals from a child process to slots in the mother process. I’m not sure this is right approach but it works. I differentiate between process as mother and child, because the word parent is alread used in the Qt context. The mother process has two threads. Main … Read more
The GNU C Library Reference Manual has a whole chapter explaining everything about signal handling. You always get the previously set signal handler (a function pointer) when you install your own handler (see manpages for signal() or sigaction()). previous_handler = signal(SIGINT, myhandler); The general rule is, that you can always reset to the previous handler … Read more
C99 sig_atomic_t conforms only to a very weak definition of “atomicity”, because C99 has no concept of concurrency, only interruptibility. (C2011 adds a concurrency model, and with it the _Atomic types that make stronger guarantees; however, AFAIK sig_atomic_t is unchanged, since its raison d’ĂȘtre is still communication with signal handlers, not across threads.) This is … Read more
Are there any other circumstances where they[destructors] will not be called? Long jumps: these interfere with the natural stack unwinding process and often lead to undefined behavior in C++. Premature exits (you already pointed these out, though it’s worth noting that throwing while already stack unwinding as a result of an exception being thrown leads … Read more
Many system calls will report the EINTR error code if a signal occurred while the system call was in progress. No error actually occurred, it’s just reported that way because the system isn’t able to resume the system call automatically. This coding pattern simply retries the system call when this happens, to ignore the interrupt. … Read more
It seems they are suppressed by default. Running $ ulimit -c unlimited Will enable core dumps for the current terminal, and it will be placed in /cores as core.PID. When you open a new session, it will be set to the default value again.
The first signal is SIGHUP; that gets sent to all processes in the process group when the terminal disconnects (hangs up – hence HUP). The second signal is SIGCONT (thanks, SiegeX, for the numbers). This is slightly surprising; it suggests you had a job stopped in the background which had to be allowed to run … Read more