public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
From: Roger Pack <rogerdpack2@gmail.com>
To: pthreads-win32 <pthreads-win32@sourceware.org>
Subject: Re: cancellation API
Date: Tue, 31 Dec 2013 16:15:00 -0000	[thread overview]
Message-ID: <CAL1QdWdWPesovkecVfZHzHRHx0JZj6FvzwQMoajCTzr6CHiX=g@mail.gmail.com> (raw)
In-Reply-To: <CAL1QdWehMtvsQ=RMo=-m1omtax=tADA97Eg320-gjFhzGXNRZQ@mail.gmail.com>

It might be interesting to "fallback" (in the case of Vista+) to using
CancelSynchronousIo if there is no QueueUserAPCEx available.  FWIW.
-roger-

On 12/30/13, Roger Pack <rogerdpack2@gmail.com> wrote:
> On 12/20/13, Mark Pizzolato - pthreads - win32
> <MarkPizzolato-pthreads-win32@subscriptions.pizzolato.net> wrote:
>> On Friday, December 20, 2013 at 9:50 AM, Roger Park wrote:
>>> After a bit of googling, i was still a bit confused.  Does the
>>> win32-pthreads api
>>> support cancellation for things like recv() from sockets or not? (I
>>> assume
>>> the
>>> standard pthreads does?) Thank you, just wondering.
>>
>> There is no special awareness of thread context from within the recv()
>> (or
>> any networking APIs).  So, canceling would be potentially problematic.
>> However, from my experience, if another thread closes the socket which
>> the
>> thread you're concerned with is reading on, the read will complete with
>> an
>> error.  The reading thread can then clean up and exit on its own.
>
> It appears from the source that win32-pthreads defines PTHREAD_CANCEL
> but then doesn't actually *do* any cancelling unless you happen to
> have this 3rd party library "QueueUserAPCEx" which appears to require
> a kernel level driver to have been loaded [?] so feels somewhat
> violent...
> FWIW.
> -roger-
>
> 	Pthreads-win32 will automatically detect if the QueueUserAPCEx DLL
> 	QuserEx.DLL is available and whether the driver AlertDrv.sys is
> 	loaded. If it is not available, pthreads-win32 will simulate async
> 	cancelation, which means that it can async cancel only threads that
> 	are runnable. The simulated async cancellation cannot cancel blocked
> 	threads.
>

      parent reply	other threads:[~2013-12-31 16:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-20 17:49 Roger Pack
2013-12-20 17:57 ` Mark Pizzolato - pthreads - win32
     [not found]   ` <CAL1QdWehMtvsQ=RMo=-m1omtax=tADA97Eg320-gjFhzGXNRZQ@mail.gmail.com>
2013-12-31 16:15     ` Roger Pack [this message]

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='CAL1QdWdWPesovkecVfZHzHRHx0JZj6FvzwQMoajCTzr6CHiX=g@mail.gmail.com' \
    --to=rogerdpack2@gmail.com \
    --cc=pthreads-win32@sourceware.org \
    /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).