Re: [PATCH 5/4] run-command: implement abort_async for pthreads

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Freitag, 1. April 2011, Erik Faye-Lund wrote:
> On Fri, Apr 1, 2011 at 11:41 AM, Erik Faye-Lund <kusmabite@xxxxxxxxx> wrote:
> > On Thu, Mar 31, 2011 at 8:45 PM, Jeff King <peff@xxxxxxxx> wrote:
> >>        kill(async->pid, 15);
> >>  #else
> >> -       /* no clue */
> >> +       pthread_cancel(async->tid);
> >
> > My worry about terminating a thread that's currently holding a mutex
> > (implicitly through the CRT?) still applies though...
>
> OK, I've read up on thread-cancellation, and this code seems correct.
> pthread_cancel doesn't kill the thread right away, it just signals a
> cancellation-event, which is checked for at certain
> cancellation-points. A lot of the CRT functions are defined as
> cancellation points, so it'll be a matter for us Win32-guys to
> implement pthread_testcancel() and inject that into the
> function-wrappers of the CRT functions that are marked as
> cancellation-points.

That's not going to happen. We cannot implement pthread_cancel() on Windows 
because it would have to be able to interrupt blocking system calls. 
(TerminateThread() is a no-no, given all the caveats about leaking system 
resources that are mentioned in the manual.)

[OK, "cannot" is a hard word. It is possible in some way, I'm sure. But that 
would mean that we implement the equivalent of Cygwin or so...]

But if I understand correctly what Jeff wrote so far, then the pthreaded case 
happens to work - by chance or by design, we don't know (yet). Perhaps we can 
get away with

-	/* no clue */
+	/* pthread_cancel(async->tid); not necessary */

-- Hannes
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]