This is the mail archive of the
mailing list for the pthreas-win32 project.
Re: cancellation API
- From: Roger Pack <rogerdpack2 at gmail dot com>
- To: pthreads-win32 <pthreads-win32 at sourceware dot org>
- Date: Tue, 31 Dec 2013 09:15:18 -0700
- Subject: Re: cancellation API
- Authentication-results: sourceware.org; auth=none
- References: <CAL1QdWeVXV2CguLFXGhxtF8AqSoAzHx7yxL9BwJn79TVhFZUww at mail dot gmail dot com> <0CC6789C1C831B4C8CCFF49D45D7010F0127D510510E at REDROOF2 dot alohasunset dot com> <CAL1QdWehMtvsQ=RMo=-m1omtax=tADA97Eg320-gjFhzGXNRZQ at mail dot gmail dot com>
It might be interesting to "fallback" (in the case of Vista+) to using
CancelSynchronousIo if there is no QueueUserAPCEx available. FWIW.
On 12/30/13, Roger Pack <email@example.com> wrote:
> On 12/20/13, Mark Pizzolato - pthreads - win32
> <MarkPizzolatofirstname.lastname@example.org> 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
>>> standard pthreads does?) Thank you, just wondering.
>> There is no special awareness of thread context from within the recv()
>> any networking APIs). So, canceling would be potentially problematic.
>> However, from my experience, if another thread closes the socket which
>> thread you're concerned with is reading on, the read will complete with
>> 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
> 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