public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* pthread_cancel doesn't work
@ 2002-11-16  3:17 pankaj bathwal
  0 siblings, 0 replies; 3+ messages in thread
From: pankaj bathwal @ 2002-11-16  3:17 UTC (permalink / raw)
  To: pthreads-win32

Hi,
I am trying to cancel a running thread.
I an using "pthread_cancel" function.
I have set cancel state as PTHREAD_CANCEL_ENABLE using
function "pthread_setcancelstate" but execution of my
thread does not stop.
what's wrong??
Do I have to something more??
Can I have a sample code??

Thanks
Pankaj


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: pthread_cancel doesn't work
  2002-11-16  8:24 ssundaragopalan
@ 2002-11-17 22:26 ` pankaj bathwal
  0 siblings, 0 replies; 3+ messages in thread
From: pankaj bathwal @ 2002-11-17 22:26 UTC (permalink / raw)
  To: ssundaragopalan; +Cc: pthreads-win32

Thanks Srikanth

Are there any system define cancellation points like
sleep, pthread_cond_wait, read, write etc
When did thread actually get cancelled???
When a running thread encounter a cancellation point
after pthread_cancel is called???
Or if a thread gets cancel when we are in system a
system define canecllation point??

Thanks again....

Regards
Pankaj

--- ssundaragopalan@hss.hns.com wrote:
> 
> 
> Hi pankaj,
>      In Windows, threads get cancelled only in
> CANCELLATION POINTS.
> So you *cannot* expect your thread to get cancelled
> as soon as you cancel
> the thread
> by calling pthread_cancel. So,unless it comes across
> a cancellation point
> it wont get cancelled.
> 
> I suggest you to do a explicit pthread_testcancel()
> in your thread which is
> a defined cancelleation point
> and the thread will relinquish when it encounters
> this.
> 
> some possible scenarios where a thread might not get
> cancelled are
> > Listening in a socket
> > waiting for a user input from console(getchar())
> 
> regds,
> srikanth
> 
> 
> 
> 
> 
> 
> pankaj bathwal <pbathwal@yahoo.com> on 11/16/2002
> 11:17:31 AM
> 
> To:   pthreads-win32@sources.redhat.com
> cc:    (bcc: Srikanth Sundaragopalan/HSSBLR)
> 
> Subject:  pthread_cancel doesn't work
> 
> 
> 
> 
> Hi,
> I am trying to cancel a running thread.
> I an using "pthread_cancel" function.
> I have set cancel state as PTHREAD_CANCEL_ENABLE
> using
> function "pthread_setcancelstate" but execution of
> my
> thread does not stop.
> what's wrong??
> Do I have to something more??
> Can I have a sample code??
> 
> Thanks
> Pankaj
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - Let the expert host your site
> http://webhosting.yahoo.com
> 
> 
> 
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: pthread_cancel doesn't work
@ 2002-11-16  8:24 ssundaragopalan
  2002-11-17 22:26 ` pankaj bathwal
  0 siblings, 1 reply; 3+ messages in thread
From: ssundaragopalan @ 2002-11-16  8:24 UTC (permalink / raw)
  To: pankaj bathwal; +Cc: pthreads-win32



Hi pankaj,
     In Windows, threads get cancelled only in CANCELLATION POINTS.
So you *cannot* expect your thread to get cancelled as soon as you cancel
the thread
by calling pthread_cancel. So,unless it comes across a cancellation point
it wont get cancelled.

I suggest you to do a explicit pthread_testcancel() in your thread which is
a defined cancelleation point
and the thread will relinquish when it encounters this.

some possible scenarios where a thread might not get cancelled are
> Listening in a socket
> waiting for a user input from console(getchar())

regds,
srikanth






pankaj bathwal <pbathwal@yahoo.com> on 11/16/2002 11:17:31 AM

To:   pthreads-win32@sources.redhat.com
cc:    (bcc: Srikanth Sundaragopalan/HSSBLR)

Subject:  pthread_cancel doesn't work




Hi,
I am trying to cancel a running thread.
I an using "pthread_cancel" function.
I have set cancel state as PTHREAD_CANCEL_ENABLE using
function "pthread_setcancelstate" but execution of my
thread does not stop.
what's wrong??
Do I have to something more??
Can I have a sample code??

Thanks
Pankaj


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-11-18  6:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-16  3:17 pthread_cancel doesn't work pankaj bathwal
2002-11-16  8:24 ssundaragopalan
2002-11-17 22:26 ` pankaj bathwal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).