Date: Tue, 26 Jul 2022 05:02:14 +0300
On 7/26/22 03:49, Thiago Macieira via Std-Discussion wrote:
> On Monday, 25 July 2022 17:26:56 PDT Ryan Nicholl wrote:
>> 64 bit wait is just two 32bit waits right next to each other... not
>> complicated with waitv. So yes, waitv allows any size wait.
>
> Right, for 64-bit you could do that. But you couldn't do a half 32-bit wait to
> support uint16_t or, for that matter, a quarter-word wait to wait on an
> atomic<bool> or atomic_flag.
You can, with masking. It may upset sanitizers and cause excessive
spurious wakeups, but it'll work. I was under impression that
gcc/libstdc++ used masking when small enough atomics were not supported
natively and I'd be surprised if they didn't do this for wait/notify.
> On Monday, 25 July 2022 17:26:56 PDT Ryan Nicholl wrote:
>> 64 bit wait is just two 32bit waits right next to each other... not
>> complicated with waitv. So yes, waitv allows any size wait.
>
> Right, for 64-bit you could do that. But you couldn't do a half 32-bit wait to
> support uint16_t or, for that matter, a quarter-word wait to wait on an
> atomic<bool> or atomic_flag.
You can, with masking. It may upset sanitizers and cause excessive
spurious wakeups, but it'll work. I was under impression that
gcc/libstdc++ used masking when small enough atomics were not supported
natively and I'd be surprised if they didn't do this for wait/notify.
Received on 2022-07-26 02:02:19