Operating System - HP-UX
1836426 Members
3557 Online
110100 Solutions
New Discussion

pthread_cancel not working on HP 11.23

 
Manish_33
Advisor

pthread_cancel not working on HP 11.23

Hi Friends,

I have below simple piece of code but it doesn't work....even though I am not able to find out any issues with it. Can anyone help me with this.

#include
#include

void hndlr(void *a){
printf("I am in pthread handler\n");
return ;
}
int main(){
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,NULL);
#ifdef A pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL);
#endif
pthread_cleanup_push(hndlr,NULL);
pthread_cancel(pthread_self());
for(;;);
pthread_cleanup_pop(0);
}


When i enable asynchronous it works.....even if it is deferred shouldn't the signal get delivered after some time ??/

my machine is
/tmp/katiyar> uname -a
HP-UX holmium B.11.23 U 9000/800 1759078586 unlimited-user license
2 REPLIES 2
Peter Godron
Honored Contributor

Re: pthread_cancel not working on HP 11.23

Manish,
have you got PHCO_29108 installed ?
" ( SR:8606294128 CR:JAGae57868 )
The cancellation operation (pthread_cancel) can race with
cancel enable/disable (pthread_setcancelstate).


Resolution:
While cancelling a thread, detect that the thread has now
disabled cancellation."

And another example of these highly annoying non-completed threads:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1039682
Manish_33
Advisor

Re: pthread_cancel not working on HP 11.23

Hi Peter,

The link for the thread that you gave was also opened by me and I haven't closed it yet coz till now I haven't got any proper soln. to it. It was a bug in HP as confirmed by them and no official patch number has been told.

Thanks for you response. I am looking at the patch you mentioned.