signals

reset sigaction to default

∥☆過路亽.° 提交于 2021-01-05 05:00:46
问题 In Android the bionic loader sets a default signal handler for every process on statrtup: void debugger_init() { struct sigaction act; memset(&act, 0, sizeof(act)); act.sa_sigaction = debugger_signal_handler; act.sa_flags = SA_RESTART | SA_SIGINFO; sigemptyset(&act.sa_mask); sigaction(SIGILL, &act, NULL); sigaction(SIGABRT, &act, NULL); sigaction(SIGBUS, &act, NULL); sigaction(SIGFPE, &act, NULL); sigaction(SIGSEGV, &act, NULL); sigaction(SIGSTKFLT, &act, NULL); sigaction(SIGPIPE, &act, NULL)

reset sigaction to default

岁酱吖の 提交于 2021-01-05 04:59:21
问题 In Android the bionic loader sets a default signal handler for every process on statrtup: void debugger_init() { struct sigaction act; memset(&act, 0, sizeof(act)); act.sa_sigaction = debugger_signal_handler; act.sa_flags = SA_RESTART | SA_SIGINFO; sigemptyset(&act.sa_mask); sigaction(SIGILL, &act, NULL); sigaction(SIGABRT, &act, NULL); sigaction(SIGBUS, &act, NULL); sigaction(SIGFPE, &act, NULL); sigaction(SIGSEGV, &act, NULL); sigaction(SIGSTKFLT, &act, NULL); sigaction(SIGPIPE, &act, NULL)

GstMultifilesink post-messages callback

家住魔仙堡 提交于 2021-01-02 16:35:14
问题 I would like to know how to get a callback from the gstreamer multifilesink element using post-messages=TRUE property? In the code below my_bus_callback function is never called. Multifilesink docs say: If the "post-messages" property is TRUE, it sends an application message named "GstMultiFileSink" after writing each buffer. http://www.freedesktop.org/software/gstreamer-sdk/data/docs/2012.5/gst-plugins-good-plugins-0.10/gst-plugins-good-plugins-multifilesink.html#GstMultiFileSink--post

GstMultifilesink post-messages callback

南楼画角 提交于 2021-01-02 16:31:02
问题 I would like to know how to get a callback from the gstreamer multifilesink element using post-messages=TRUE property? In the code below my_bus_callback function is never called. Multifilesink docs say: If the "post-messages" property is TRUE, it sends an application message named "GstMultiFileSink" after writing each buffer. http://www.freedesktop.org/software/gstreamer-sdk/data/docs/2012.5/gst-plugins-good-plugins-0.10/gst-plugins-good-plugins-multifilesink.html#GstMultiFileSink--post

c++11 use condition variable in signal handler

瘦欲@ 提交于 2021-01-02 05:34:05
问题 Is it safe to use std::condition_variable::notify_one in signal handler? Example: enum State { DoNot, Do, }; State state; std::mutex mutex; // worker thread std::thread th = std::thread([]() { std::unique_lock<std::mutex> lc(mutex); cv.wait(lc, []() { return state; }); }); //signal handler void handler(int sig) { if (sig == SOME_SIG) { std::unique_lock<std::mutex> lc(mutex); state = Do; cv.notify_one(); } } 回答1: A C++14 draft standard N4296 says: [support.runtime]/10 The common subset of the

c++11 use condition variable in signal handler

混江龙づ霸主 提交于 2021-01-02 05:32:08
问题 Is it safe to use std::condition_variable::notify_one in signal handler? Example: enum State { DoNot, Do, }; State state; std::mutex mutex; // worker thread std::thread th = std::thread([]() { std::unique_lock<std::mutex> lc(mutex); cv.wait(lc, []() { return state; }); }); //signal handler void handler(int sig) { if (sig == SOME_SIG) { std::unique_lock<std::mutex> lc(mutex); state = Do; cv.notify_one(); } } 回答1: A C++14 draft standard N4296 says: [support.runtime]/10 The common subset of the

what does C/C++ handler SIGFPE?

对着背影说爱祢 提交于 2020-12-30 07:36:32
问题 well, I have searched the articles about SIGFPE ,then I wrote a few tests but it's behavoir is strange. Then I have to post it here to ask for help. Is the GCC/G++ or ISO C++ clearly defined what happens if divide by zero? 1) I searched the article : Division by zero does not throw SIGFPE it sames the output is inf 2) If I rewrite it as the following: void signal_handler (int signo) { if(signo == SIGFPE) { std::cout << "Caught FPE\n"; } } int main (void) { signal(SIGFPE,(*signal_handler));

How can i use signals in django bulk create

99封情书 提交于 2020-12-28 13:11:11
问题 I have this code Task.objects.bulk_create(ces) Now this is my signal @receiver(pre_save, sender=Task) def save_hours(sender, instance, *args, **kwargs): logger.debug('test') Now this signal is not triggered in bulk create I am using django 1.8 回答1: As mentioned bulk_create does not trigger these signals - https://docs.djangoproject.com/en/1.8/ref/models/querysets/#bulk-create This method inserts the provided list of objects into the database in an efficient manner (generally only 1 query, no

sending signal from parent to child

限于喜欢 提交于 2020-12-01 07:15:08
问题 I am using this tutorial from website http://www.code2learn.com/2011/01/signal-program-using-parent-child.html and trying to understand why signal is not recieved by child? here is the code: #include <stdio.h> #include <signal.h> #include <stdlib.h> void sighup(); /* routines child will call upon sigtrap */ void sigint(); void sigquit(); void main() { int pid; /* get child process */ if ((pid = fork()) < 0) { perror("fork"); exit(1); } if (pid == 0) { /* child */ signal(SIGHUP,sighup); /* set

Multiple alarms in C?

一世执手 提交于 2020-11-29 23:56:39
问题 This is probably a very basic question, but I'm using the code below to run a simple alarm. It works as I want it to, but I'm wondering if it's at all possible to run multiple alarms simultaneously that each trigger a different function when complete. Is there a way to do that? #include <signal.h> #include <sys/time.h> #include <stdio.h> #include <time.h> void alarm_handler(int signum){ printf("five seconds passed!!\n"); } int main(){ signal(SIGALRM, alarm_handler); alarm(5); pause(); return