Article View: comp.arch
Article #422Re: Interrupts in OoO
From: EricP
Date: Wed, 28 Oct 2026 18:39
Date: Wed, 28 Oct 2026 18:39
36 lines
2915 bytes
2915 bytes
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. 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. 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:
<2krES.62082$BaS5.11177@fx35.iad>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx35.iad.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>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx35.iad.POSTED!not-for-mail MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: EricP <ThatWouldBeTelling@thevillage.com> Subject: Re: Interrupts in OoO Newsgroups: comp.arch 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> Content-Language: en-CA In-Reply-To: <11bofs0$vhqi$1@dont-email.me> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Lines: 36 Message-ID: <2krES.62082$BaS5.11177@fx35.iad> X-Complaints-To: abuse@UsenetServer.com NNTP-Posting-Date: Wed, 28 Oct 2026 18:39:58 UTC Date: Wed, 28 Oct 2026 14:39:56 -0400 X-Received-Bytes: 2683