Article View: comp.lang.c++
Article #827Re: How to write a semaphore with futexes
From: Chris M. Thomasson
Date: Wed, 11 Nov 2026 22:12
Date: Wed, 11 Nov 2026 22:12
16 lines
1906 bytes
1906 bytes
On 11/10/2026 11:06 PM, Bonita Montero wrote: > Am 10.11.2026 um 22:32 schrieb Chris M. Thomasson: > >> Fwiw, why not use a kernel semaphore as a slow path? Is this just for >> fun? > > Because signalling or waiting on a semaphore can fail, whereas a futex > only has invalid parameters error codes. I need a solution that is like > a futes in that sense. > I see. A fun failure on a sem_wait is EINTR. https://pubs.opengroup.org/onlinepubs/007908799/xsh/sem_wait.html I have seen a lot of code that fails to handle it.
Technical Details
Message-ID:
<11d2p9c$3eke4$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11cvher$2ahke$1@raubtier-asyl.eternal-september.org> <11d02gm$2h8g0$1@dont-email.me> <11d145g$2qlhs$1@raubtier-asyl.eternal-september.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!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.lang.c++ Subject: Re: How to write a semaphore with futexes Date: Wed, 11 Nov 2026 14:12:59 -0800 Organization: A noiseless patient Spider Lines: 16 Message-ID: <11d2p9c$3eke4$1@dont-email.me> References: <11cvher$2ahke$1@raubtier-asyl.eternal-september.org> <11d02gm$2h8g0$1@dont-email.me> <11d145g$2qlhs$1@raubtier-asyl.eternal-september.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 11 Nov 2026 22:13:01 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3625412"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+QNNvg54+bI/m89hxwfdC+Wc6iWH7po9A="; posting-host="11f9b5e6e37d99a5324f29576617ac26" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:xBmFniq8I3Hq5E39sQQfddYhGFA= sha256:B8+rp9uwWuMhFp+GfW0P9RdG1xtJkdk9F0WS5lCeLqs= sha1:MS+89AvSHIspMy9oecyWYbKSVhk= sha256:TkQasGCtpOr+lUjhwm4Dtvp039mpiNAd228AB8KXZ8Y= Content-Language: en-US In-Reply-To: <11d145g$2qlhs$1@raubtier-asyl.eternal-september.org>