The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



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

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 09-27-2009
Sedighzadeh Sedighzadeh is offline
Registered User
  
 

Join Date: Aug 2009
Posts: 7
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
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:34 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0