Skip to content

Display#wake must likley be volatile #3060

@laeubi

Description

@laeubi

Linux + Mac have both a boolean wake field, that is evaluated in Display#sleep inside a loop.
Even though the method wake() is synchronized on the display and marked with "this method may be called from any thread", the sleep method is not synchronizing when checking this flag.

As wake is not marked as volatile the JVM is allowed to cache the value of wake in a register and only write it back when the method ends and do not see other threads write in the meanwhile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions