[PATCH 1/2] condition_variable: Report early wakeup of wait_until as no_timeout
Jonathan Wakely
jwakely@redhat.com
Tue Jul 24 19:48:00 GMT 2018
On 24/07/18 21:44 +0200, François Dumont wrote:
>On 24/07/2018 13:57, Jonathan Wakely wrote:
>>On 24/07/18 12:04 +0200, François Dumont wrote:
>>>
>>>This patch claims that it just replaces a cv_status::timeout into
>>>cv_status::no_timeout if we didn't wait enough. But it also
>>>replaces any cv_status returned by __wait_until_impl into a
>>>cv_status::no_timeout, is that intentional ? IMHO it should store
>>>the returned status and return it unchanged if not timeout.
>>
>>But __wait_until_impl can only return timeout or no_timeout:
>>
>>enum class cv_status { no_timeout, timeout };
>>
>I didn't want to check __wait_until_impl cause my remark was more general.
>
>But if enum only has 2 entries it sounds safe enough indeed.
It's a scoped enumeration, so all the values of its underlying type
are valid values of the enumeration type i.e. somebody could do
cv_status{413} and it would be valid. But __wait_until_impl doesn't do
that, and never will, and wait_until is required to only return
timeout or no_timeout, so Mike's patch would still be correct anyway
even if __wait_until_impl did something dumb :-)
More information about the Libstdc++
mailing list