Article View: comp.arch
Article #429Re: Interrupts in OoO
From: Chris M. Thomasson
Date: Wed, 28 Oct 2026 22:10
Date: Wed, 28 Oct 2026 22:10
52 lines
3608 bytes
3608 bytes
On 10/28/2026 11:39 AM, EricP wrote: > On 2026-Oct-26 17:14, Chris M. Thomasson wrote: >> On 10/26/2026 2:03 PM, EricP wrote: >>> >> >> Have you ever messed around with a Pthread async cancel? >> >> PTHREAD_CANCEL_ASYNCHRONOUS >> >> Iirc, a pthread emulation over on windows had to use a damn kernel >> driver to do it. I say, avoid at all costs! > > No, I have never used Pthreads and I have no idea > how it is implemented on Windows. Okay. > > It sounds like it calls TerminateThread which does exactly that, > without giving an application any chance to clean up nicely. > But in the Unix manuals I also see warnings about the use of > async cancel in general on any implementation. Its odd. It needs an actual kernel driver to implement PTHREAD_CANCEL_ASYNCHRONOUS via, iirc, kernel mode APC. > > VMS got this one right - the ability to asynchronously force a > process/thread to do a clean exit. > A call to SYS$FORCEEX posts a user mode AST to the process/thread, > which *interrupts* and raises a FORCE_EXIT exception in the process/thread, > allowing stack exception catch handlers or thread exit rundown handlers > a chance to clean up properly (release mutexes, finish a heap > allocation without corrupting the heap, etc). > > WNT doesn't have asynchronous (interrupting) user mode APC's, > just synchronous (polled) ones at alertable waits. > So you can't always force another thread to do your bidding like stopping. > (It is actually possible to do this using GetThreadContext and > SetThreadContext. > But as this would be non-standard the surrounding code for things like > mutex holders and heap allocators would not expect it and would have no > supporting exit handler code for it. > Also Get/SetThreadContext requires debug privilege.) > >
Technical Details
Message-ID:
<11btrsu$2rb9b$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<2024Oct3.160055@mips.complang.tuwien.ac.at> <vdmrk6$3rksr$1@dont-email.me> <LyELO.69485$2nv5.62232@fx39.iad> <TdWLO.282116$FzW1.158190@fx14.iad> <963a276fd8d43e4212477cefae7f6e46@www.novabbs.org> <8IcMO.249144$v8v2.147178@fx18.iad> <2024Oct5.195712@mips.complang.tuwien.ac.at> <6adbf319.9129937@news.eternal-september.org> <1792869649-5857@newsgrouper.org> <fCpDS.27362$9b8f.8498@fx39.iad> <L%JDS.15598$fJ0f.4191@fx44.iad> <11bo1vr$pqob$1@dont-email.me> <zePDS.2$1GC5.1@fx45.iad> <11bofs0$vhqi$1@dont-email.me> <2krES.62082$BaS5.11177@fx35.iad>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> Newsgroups: comp.arch Subject: Re: Interrupts in OoO Date: Wed, 28 Oct 2026 15:10:36 -0700 Organization: A noiseless patient Spider Lines: 52 Message-ID: <11btrsu$2rb9b$1@dont-email.me> References: <2024Oct3.160055@mips.complang.tuwien.ac.at> <vdmrk6$3rksr$1@dont-email.me> <LyELO.69485$2nv5.62232@fx39.iad> <TdWLO.282116$FzW1.158190@fx14.iad> <963a276fd8d43e4212477cefae7f6e46@www.novabbs.org> <8IcMO.249144$v8v2.147178@fx18.iad> <2024Oct5.195712@mips.complang.tuwien.ac.at> <6adbf319.9129937@news.eternal-september.org> <1792869649-5857@newsgrouper.org> <fCpDS.27362$9b8f.8498@fx39.iad> <L%JDS.15598$fJ0f.4191@fx44.iad> <11bo1vr$pqob$1@dont-email.me> <zePDS.2$1GC5.1@fx45.iad> <11bofs0$vhqi$1@dont-email.me> <2krES.62082$BaS5.11177@fx35.iad> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 28 Oct 2026 22:10:39 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2993451"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19fHWak7ys72dYOjqlz9/dKk0eyi8cENsM="; posting-host="ce22479583babc8631500b8cafa91fe8" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:F3+3MaLzou/+L3yFquEH5Wd+bw0= sha256:pnaZ5fMXetDji0P4tDkkifEtRXQALcfUuGPqRW6mFL0= sha1:QVaapRkRCTdL5ztYMnC2hXbj0Zk= sha256:8w/ikKJNk8lOE7xrzjwnsl4QqVEByXJd3ypwW8HInCY= In-Reply-To: <2krES.62082$BaS5.11177@fx35.iad> Content-Language: en-US