signals

C# Using data from Excel to simulate a Signal over time

点点圈 提交于 2019-12-13 02:56:59
问题 is there any good way how i can import a Excel file with signal values (40,000 values, ~100 minutes measurement time) and simulate a signal over time with it? I want to reconstruct the simulation with timestamp and Signal values. I've two columns: Timestamp for every value (it isn't equidistant) Signal-Value The timestamp should be nearly synchron with the simulationtime. Maybe someone has a good "to start" idea? Thank you! Update #1 (based on the comments): @Wouter de Kort: I got data from

Scanf with Signals

耗尽温柔 提交于 2019-12-13 02:51:38
问题 I have a signal that blocks SIGINT and basically says "Sorry, you can't quit.\n" The issue is this can occur during a scanf. When this occurs during a scanf, scanf takes in the printf as input. How can I do a printf that will cause scanf to basically hit the enter key automatically. I don't care that I am getting bad input. I just want to programatically finish that scanf with a printf or something else. Process: scanf("get stuff") -> User is able to enter stuff in. -> SIGINT occurs and goes

Handling CTRL-C in dummy shell

余生颓废 提交于 2019-12-13 02:50:50
问题 I'm writing a dummy shell that should not terminate when the user types ctrl-C but should just generate a new prompt line. Currently, my shell does not terminate when I type ctrl-C but it still does not print the new prompt line. Do you know why this is the case and how I can fix this? My code is below: #include <stdlib.h> #include <stdio.h> #include <errno.h> #include <string.h> #include <unistd.h> #include <sys/wait.h> #include <signal.h> #define BUFFER_SIZE 1<<16 #define ARRAY_SIZE 1<<16

Signal handling and check pointing for mpif90

◇◆丶佛笑我妖孽 提交于 2019-12-13 02:39:25
问题 I have written a code for trapping the signal for CTRL+C for gfortran and it works. program trap external trap_term call signal(2, trap_term) call sleep(60) end program trap function trap_term() integer::trap_term print*,'done' call exit(trap_term) end function trap_term How would one write exactly same thing for mpif90 ? Also, what is the best way to include checkpoints and restart (probably automatic) the code (from where left before) in parallel processors. This is required because I have

Signal Handling in Windows

£可爱£侵袭症+ 提交于 2019-12-13 02:23:55
问题 In Windows I am trying to create a python process that waits for SIGINT signal.And when it receives SIGINT I want it to just print a message and wait for another occurrence of SIGINT.So I used signal handler. Here is my signal_receiver.py code. import signal, os, time def handler(signum, frame): print 'Yes , Received', signum signal.signal(signal.SIGINT, handler) print 'My process Id' , os.getpid() while True: print 'Waiting for signal' time.sleep(10) When this process running ,I just send

Why can't I call the function (signal handler) returned by function signal?

北慕城南 提交于 2019-12-13 02:15:27
问题 After figuring out the signature of the signal function, I modified the example given by https://en.cppreference.com/w/c/program/signal. But why can't I call the function (the signal handler) returned by the signal , instead I can call it direclty ? void (*signal( int sig, void (*handler) (int))) (int); The signal function returns a pointer to function, which is void (*)(int) . Return value Previous signal handler on success or SIG_ERR on failure (setting a signal handler can be disabled on

Python - prevent child threads from being affected from SIGINT signal

五迷三道 提交于 2019-12-13 01:57:36
问题 I have a program that consist of a runner (which is the main thread) that creates 1 or more child threads which mainly use subprocesses to trigger 3rd party apps. I wanted to be able to gracefully terminate all threads once a SIGINT is received, hence I defined a handler in my main thread as following: signal.signal(signal.SIGINT, handler) I initially though that once a SIGINT is received then it will affect only my main thread and then I'll be able to manage the child threads to terminate,.

Signal handler and waitpid coexisting

南楼画角 提交于 2019-12-13 01:16:02
问题 I'm coding a shell in C that should support background and foreground processes. Constraints: Background processes that terminate should be caught by signal handler No global variables can be used for communicating from signal handler No list of processes/pids allowed My solution: Waitpid until foreground process terminates For background processes, immediately return to prompt Handler catches SIGCHLD where waitpid is used to clear process table Problem: Foreground processes also trig handler

How to set the paused process to background?

余生长醉 提交于 2019-12-12 23:08:34
问题 I am new in C. I am trying to make a shell - like program. I am currently making a signal handler, which means, when the process is running and somebody pressed ctrl + Z the process should pause and go to background while shell has to continue. The problem here is: parent process is making wait(NULL) , but child is not ending the program so basically parent waits the child which is not ending the program yet. How to make it so that parent continues to work foreground. (you can see my code How

No command executed after performing kill command in shell script

和自甴很熟 提交于 2019-12-12 22:38:09
问题 Here is my shell script: #!/bin/bash PIDS=$(ps -e | grep $1 |grep -v grep| awk '{print $1}') kill -s SIGINT $PIDS echo "Done sendings signal" I am passing the name of the process as command line argument. The echo command is not getting executed, although the target processes are actually receiving the SIGINT signal and exited. Any suggestions? Update: I changed the code to: #!/bin/bash PIDS=$(ps -e |grep $1 | grep -v grep | awk '{print $1}'|grep -v $$) echo $PIDS kill -s SIGINT $PIDS echo