- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Why SIGALRM can't happen in thread on HP-UX?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2013 01:20 AM
07-30-2013 01:20 AM
Re: Why SIGALRM can't happen in thread on HP-UX?
Hi yang,
You havent indicated your code donig SIG_UNBLOCK in new thread as Dennis said. Can you confirm that?
Also, pthread_kill() worked because you are forcing signal to be sent to new thread, while alarm will make it to post on process, where kernel will direct it to an appropriate thread.
Thanks, Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2013 01:27 AM
07-30-2013 01:27 AM
Re: Why SIGALRM can't happen in thread on HP-UX?
Hi Ramesh
I confirm that I BLOCK the signal in mainthread, and UNBLOCK in new thread, but cann't receive the signal in new thread.
but if I use pthread_kill to sent the alarm signal directly to the new thread, the ALARM signal can be received by the new thread.
thanks
yang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2013 01:40 AM
07-30-2013 01:40 AM
Re: Why SIGALRM can't happen in thread on HP-UX?
In fact, I didn't use SIG_UNBLOCK . I just keep the original setting in old_signal_set, coz by default the ALARM is not blocked, so after block, I reset the original setting for unblock action. please refer to :
static sigset_t sig_set;
static sigset_t old_sig_set;
void BlockSignalAlarm()
{
sigemptyset( &sig_set );
sigaddset( &sig_set,SIGALRM );
int err = pthread_sigmask( SIG_BLOCK, &sig_set, &old_sig_set );
if( err != 0 )
printf("error %d occured when block signal alarm", err );
else
printf("block signal alarm");
}
void UnblockSignalAlarm()
{
int err = pthread_sigmask(SIG_SETMASK,&old_sig_set,NULL);
if( err != 0 )
printf("error %d occured when unblock signal alarm", err );
else
printf("unblock signal alarm") ;
}
after the process started, I call BlockSignalAlarm to keep the old_sig_set status firstly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2013 03:26 AM
07-30-2013 03:26 AM
Re: Why SIGALRM can't happen in thread on HP-UX?
Hi yang,
I have left my program running in loop for a while, which uses routines you have shown here and I dont seem to see it failing. I presume those timing windows would have been taken care of.
Are you able to easily reproduce this? Would it be possible to share the full program which failed for you?
Thanks, Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2013 03:33 AM
07-30-2013 03:33 AM
Re: Why SIGALRM can't happen in thread on HP-UX?
Hi,Ramesh
It is my fault, I found the code can run correctly on another HP ITA64 machine. but failed on my certain machine although it is the same HP ITA64.
why?
yang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2013 05:26 AM
07-30-2013 05:26 AM
Re: Why SIGALRM can't happen in thread on HP-UX?
I have edited my first response to clarify - signal going to process instead of thread was the main reason for original problem you mentioend. If you are facing this issue even after ensuring that signal should come to a particular thread, there should be something worth taking a closer look. Looking at your program would be helpful yang.
Thanks, Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2013 12:12 AM
07-31-2013 12:12 AM
Re: Why SIGALRM can't happen in thread on HP-UX?
> I just keep the original setting in old_signal_set, coz by default the ALARM is not blocked
You might want to try my SIG_UNBLOCK fragment.
- « Previous
-
- 1
- 2
- Next »