![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Intercepting SIGINT in a bash script | Starcast | Shell Programming and Scripting | 5 | 07-06-2009 10:29 PM |
| Ubuntu Intrepid Ibex raises the bar | iBot | UNIX and Linux RSS News | 0 | 11-04-2008 12:40 PM |
| Problem with handling SIGINT | JamesGoh | High Level Programming | 3 | 02-24-2008 10:39 PM |
| Virtual machine manager raises the bar - Australian IT | iBot | UNIX and Linux RSS News | 0 | 08-21-2007 09:50 AM |
| Virtual machine manager raises the bar - Australian IT | iBot | UNIX and Linux RSS News | 0 | 08-20-2007 11:20 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
why multiple SIGINT raises when i hit C-c
hi,
in my application, i have set up to capture SIGINT and execute a handler.the problem is whenever i hit C-c, multiple SIGINT are sent to the application.I have blocked the SIGINT right after catching the first one but it is unsuccessful.Here is what i do : jmp_buf main_loop; int main() { signal(SIGINT,CleanExit); sigset_t set; sigset_t old_set; sigemptyset(&set); sigemptyset(&old_set); sigaddset (&set, SIGINT); // run other threads ... while( 1 ) { if ( setjmp (main_loop) ) { pthread_sigmask(SIG_BLOCK,&set,&old_set); /// Clean up and shut down threads pthread_sigmask(SIG_UNBLOCK,&set,&old_set); break; } } printf("\nbye!\n"); return 0; } void CleanExit() { shutdownThreads = 1; longjmp (main_loop, 1); } The problem is the CleanExit method runs 3 to 4 times which means the pthread_sigmask(SIG_BLOCK,&set,&old_set); has not done the job. So what is the problem? My application is running in mulinux. Thanks in advance, Sedighzade |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|