| Deutsch English Français Italiano |
|
<vast3j$imrm$1@raubtier-asyl.eternal-september.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: news.eternal-september.org!eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita Montero <Bonita.Montero@gmail.com>
Newsgroups: comp.lang.c++
Subject: Re: Futexes ain't fast
Date: Fri, 30 Aug 2024 18:47:51 +0200
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <vast3j$imrm$1@raubtier-asyl.eternal-september.org>
References: <van414$3fe9t$1@raubtier-asyl.eternal-september.org>
<vanrkt$3j1oq$1@dont-email.me>
<vaor7n$3r4u5$1@raubtier-asyl.eternal-september.org>
<vaosod$3ra5a$2@dont-email.me> <vaosr5$3ra5a$3@dont-email.me>
<vapkh5$3ukli$1@raubtier-asyl.eternal-september.org>
<vappqr$3vdim$1@raubtier-asyl.eternal-september.org>
<vaq0l6$g4l$1@raubtier-asyl.eternal-september.org>
<vaqkng$3vj5$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 30 Aug 2024 18:47:47 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="22fa54b4466af970c3e8d7b644a2159b";
logging-data="613238"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19PYWboBkkkxB5LkgLQ+Z22o3gLqFlnbYE="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:R67NcHSeyL0/M+dzz1TFG9VwCzA=
Content-Language: de-DE
In-Reply-To: <vaqkng$3vj5$2@dont-email.me>
Am 29.08.2024 um 22:12 schrieb Chris M. Thomasson:
> On 8/29/2024 7:30 AM, Bonita Montero wrote:
>> This is by far the fastest code:
>>
>> #if defined(_WIN32)
>> HANDLE hSem = CreateSemaphoreA( nullptr, 0, 0x7FFFFFFF, nullptr );
>> auto acquire = [&] { WaitForSingleObject( hSem, INFINITE ); };
>> auto release = [&] { ReleaseSemaphore( hSem, 1, nullptr ); };
>> #elif defined(__unix__)
>> sem_t sem;
>> sem_init( &sem, 0, 0 );
>> auto acquire = [&] { while( sem_wait( &sem ) == EINTR ); };
> [...]
>
> Nice touch with the EINTR. I have seen a lot of code that misses this
> aspect... Yikes!
Signals are really sick.