This is the mail archive of the pthreads-win32@sourceware.org mailing list for the pthreas-win32 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cancellation API


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]