public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
From: Ross Johnson <rpj@ise.canberra.edu.au>
To: Rajiv K Shukla <rshukla@vin.bellcore.com>
Cc: pthreads-win32@sourceware.cygnus.com
Subject: Re: Asynchronous cancel
Date: Thu, 12 Aug 1999 04:34:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.05.9908122114110.6523-100000@swan.canberra.edu.au> (raw)
In-Reply-To: <199908101804.EAA24054@ise.canberra.edu.au>

On Tue, 10 Aug 1999, Rajiv K Shukla wrote:

> Hello All,
> 
> Sorry if the question has been asked before. We're trying to see if we
> could use the pthreads-win32 package to port our code to NT. It's been
> fine so far but we have hit a snag. It seems that
> pthread_setcanceltype doesn't really do anything. It sets an integer
> variable cancelType (which is part of the pthread_t structure) but the
> flag is used no where. Looks like the only way to cancel a thread is
> to call pthread_cancel and within the cancelled thread call
> pthread_testcancel. But we'd like to be able to cancel a thread
> asynchronously, e.g one of our thread sleeps for a configurable amount
> of time and it could be set pretty high, 1 hour, or 10 hours, or
> whatever. If within the thread I need to call pthread_testcancel in
> order to be cancelled then it's a problem. We'd have to wait that much
> time before we're even able to call pthread_testcancel. 
> 
> I'd appreciate any suggestion that you may have.
> 

At present there is no way in general to asynchronously cancel a
thread. The best device on offer in the package is the
pthreadCancelableWait() and pthreadCancelableTimedWait() functions
(both non-POSIX and non-portable). See the code and comments in
misc.c. They respond to pthread_cancel().

Cheers.
Ross

+----------------------+---+
| Ross Johnson         |   | E-Mail: rpj@ise.canberra.edu.au
| Info Sciences and Eng|___|
| University of Canberra   | FAX:    +61 6 2015227
| PO Box 1                 |
| Belconnen  ACT    2616   | WWW:    http://willow.canberra.edu.au/~rpj/
| AUSTRALIA                |
+--------------------------+


       reply	other threads:[~1999-08-12  4:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <199908101804.EAA24054@ise.canberra.edu.au>
1999-08-12  4:34 ` Ross Johnson [this message]
2000-07-12 14:04   ` minor bug fix for WinCE in dll.c Tristan Savatier
1999-08-12  6:54 Asynchronous cancel Bossom, John
  -- strict thread matches above, loose matches on Subject: below --
1999-08-10 11:03 Rajiv K Shukla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.05.9908122114110.6523-100000@swan.canberra.edu.au \
    --to=rpj@ise.canberra.edu.au \
    --cc=pthreads-win32@sourceware.cygnus.com \
    --cc=rshukla@vin.bellcore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).