Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MpUnboundedXaddChunk::soPrev uses putObject #308

Open
hl845740757 opened this issue Jun 1, 2020 · 5 comments
Open

MpUnboundedXaddChunk::soPrev uses putObject #308

hl845740757 opened this issue Jun 1, 2020 · 5 comments

Comments

@hl845740757
Copy link
Contributor

hl845740757 commented Jun 1, 2020

This may be a naming error that is confusing.

    final void soPrev(R value)
    {
        UNSAFE.putObject(this, PREV_OFFSET, value);
    }
@franz1981
Copy link
Collaborator

@hl845740757 Thanks for sharing: just sent a PR to address this correctly

@franz1981
Copy link
Collaborator

@hl845740757 I still think that the peek/relaxedPeek issue you've found for other queues is present as well for the xadd qs

@hl845740757
Copy link
Contributor Author

@franz1981 I am working on it.

@hl845740757
Copy link
Contributor Author

@franz1981 Did you forget to release cChunk.prev here

    final void moveToNextConsumerChunk(R cChunk, R next)
    {
        // avoid GC nepotism
        cChunk.soNext(null);
        next.soPrev(null);
        // no need to cChunk.soIndex(NOT_USED)
        if (cChunk.isPooled())
        {
            final boolean pooled = freeChunksPool.offer(cChunk);
            assert pooled;
        }
        this.soConsumerChunk(next);
        // MC case:
        // from now on the code is not single-threaded anymore and
        // other consumers can move forward consumerIndex
    }

@franz1981
Copy link
Collaborator

cChunk.prev should always be null at this point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants