- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- pthread cancel on HPUX
Operating System - Linux
1753587
Members
6600
Online
108796
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
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
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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-02-2006 10:39 PM
тАО07-02-2006 10:39 PM
pthread cancel on HPUX
Hello friends,
I am having some confusions regarding use of pthread_cancel and
pthread_cleanup_push. Even though i have made my thread as
cancellation enabled and asynchronous cancellation enabled.....it
doesn't seem to catch them unless a cancellation point is
reached.......Could someone throw some light on this.......Below is my
sample program...
#include
#include
#include
pthread_t stid;
void hndlr(void *a){
printf("I am in pthread handler\n");
return ;
}
void *sstart(void *tid){
int oldstate;
fprintf(stderr,"Starting second child tid=%d\n",pthread_self());
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,&oldstate); /*Enable
cancellation again*/
fprintf(stderr,"Enabled cancelling, old state was %d\n",oldstate);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,&oldstate);
/*Enable asynchronous cancellation*/
fprintf(stderr,"Enabled asynchronous cancelling, old state was
%d\n",oldstate);
pthread_cleanup_push(hndlr,NULL);
printf("\nI have pushed a function\n");
pthread_cancel(pthread_self());
printf("\nThis is a cancellation point.\n");
pthread_cleanup_pop(0);
return NULL ;
}
int main(){
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_create(&stid,&attr,sstart,NULL);
pthread_join(stid,NULL);
return 0;
}
As you can see if i comment out the printf statement..."This is a
cancellation point" the handler will not be called.....Why is that i
need an explicit cancelation point ??
I am having some confusions regarding use of pthread_cancel and
pthread_cleanup_push. Even though i have made my thread as
cancellation enabled and asynchronous cancellation enabled.....it
doesn't seem to catch them unless a cancellation point is
reached.......Could someone throw some light on this.......Below is my
sample program...
#include
#include
#include
pthread_t stid;
void hndlr(void *a){
printf("I am in pthread handler\n");
return ;
}
void *sstart(void *tid){
int oldstate;
fprintf(stderr,"Starting second child tid=%d\n",pthread_self());
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,&oldstate); /*Enable
cancellation again*/
fprintf(stderr,"Enabled cancelling, old state was %d\n",oldstate);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,&oldstate);
/*Enable asynchronous cancellation*/
fprintf(stderr,"Enabled asynchronous cancelling, old state was
%d\n",oldstate);
pthread_cleanup_push(hndlr,NULL);
printf("\nI have pushed a function\n");
pthread_cancel(pthread_self());
printf("\nThis is a cancellation point.\n");
pthread_cleanup_pop(0);
return NULL ;
}
int main(){
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_create(&stid,&attr,sstart,NULL);
pthread_join(stid,NULL);
return 0;
}
As you can see if i comment out the printf statement..."This is a
cancellation point" the handler will not be called.....Why is that i
need an explicit cancelation point ??
- Tags:
- pthread
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-10-2006 03:25 PM
тАО07-10-2006 03:25 PM
Re: pthread cancel on HPUX
It appears you have moved this discussion to:
HPUX-DEVTOOLS: Cancellation points in HP
HPUX-DEVTOOLS: Cancellation points in HP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2006 07:37 PM
тАО09-12-2006 07:37 PM
Re: pthread cancel on HPUX
This is a bug in HP and they have promised to release an official patch for this. Till now no official patch is available.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP