On Fri, 9 May 2025 14:50:49 GMT, Viktor Klang <vkl...@openjdk.org> wrote:

>>> I'm a bit uneasy about incrementing the `count` in `linkFirst` but not 
>>> enforcing the invariant. What's the benefit to changing linkFirst and 
>>> linkLast to return void instead of keeping the original returning a boolean?
>> 
>> I based the approach on the LBQ enqueue() and dequeue() methods, which also 
>> return void and have a comment with the assertion.
>
> I understand, alas LBQ enqueue() and dequeue() don't increment a counter. It 
> seems a bit brittle that the invariant needs to be maintained *externally* to 
> the state modification. For the sake of maintainability I think the checks 
> and the increment/decrement belongs in the same unit of work.

This is what I meant about reducing sequential consistency. But it does work 
out in terms of maintaining specs.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24925#discussion_r2084442740

Reply via email to