C++ Logo

std-discussion

Advanced search

Re: Contradiction in the description of the function std::call_once

From: Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
Date: Wed, 1 Mar 2023 20:30:02 +0100
Il 01/03/23 20:19, Vladimir Grigoriev via Std-Discussion ha scritto:
> «Among all executions of call_once for any given once_flag: at most one
> is a returning execution; if there is a returning execution, it is the
> last active execution; and there are passive executions only if there is
> a returning execution»
> So if to exclude an exceptional execution then actually there can be at
> most only one active execution.

What do you mean by this? The whole point is that there can be at most
one *returning* execution, but as many active as you want (if they are
*exceptional*). Note the wording "the last active", implying there can
be more than one.


> However further there is written: «For any given once_flag: all active
> executions occur in a total order»
> What active executions? The function func can be called only once. So we
> can have only one active execution. All others are passive executions.

Again, what do you mean? You can have multiple active executions if the
callable throws an exception.

Thanks,
-- 
Giuseppe D'Angelo

Received on 2023-03-01 19:30:07