Announcement

Collapse
No announcement yet.

variables with UPROPERTY attribute cannot be decleared as "volatile"?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    variables with UPROPERTY attribute cannot be decleared as "volatile"?

    Hi people:
    UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category=Gameplay)
    bool volatile IsLeft;

    this piece of code cannot pass compilation, it said that
    Unrecognized type 'volatile'

    but without setting it to UPROPERTY, it will pass the compilation.
    Is there anyway to let UPROPERTY marked variable thread safe?

    Thanks
    Walter.

    #2
    The volatile keyword doesn't make your variable thread safe at all. You need to use other mechanisms to do that. volatile will only assure that if some hardware wrote to that memory that you will see that change when you read the variable.

    Comment


      #3
      I kept the read and write operation be atomic so currently no need to add locks, but how to add volatile keyword?

      Comment


        #4
        btw the volatile is place before the bool, I wrongly pasted it.

        Comment

        Working...
        X