public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* cancellation API
@ 2013-12-20 17:49 Roger Pack
  2013-12-20 17:57 ` Mark Pizzolato - pthreads - win32
  0 siblings, 1 reply; 3+ messages in thread
From: Roger Pack @ 2013-12-20 17:49 UTC (permalink / raw)
  To: pthreads-win32

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.
-roger-

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

* RE: cancellation API
  2013-12-20 17:49 cancellation API Roger Pack
@ 2013-12-20 17:57 ` Mark Pizzolato - pthreads - win32
       [not found]   ` <CAL1QdWehMtvsQ=RMo=-m1omtax=tADA97Eg320-gjFhzGXNRZQ@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Pizzolato - pthreads - win32 @ 2013-12-20 17:57 UTC (permalink / raw)
  To: Roger Pack, pthreads-win32

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.

- Mark

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

* Re: cancellation API
       [not found]   ` <CAL1QdWehMtvsQ=RMo=-m1omtax=tADA97Eg320-gjFhzGXNRZQ@mail.gmail.com>
@ 2013-12-31 16:15     ` Roger Pack
  0 siblings, 0 replies; 3+ messages in thread
From: Roger Pack @ 2013-12-31 16:15 UTC (permalink / raw)
  To: pthreads-win32

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.
>

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

end of thread, other threads:[~2013-12-31 16:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-20 17:49 cancellation API 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 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).