private volatile int threadStatus = 0;

Viewed 31

Why use volatile to declare threadStatus field in Thread.java. It seems that the variable is not shared by multiple threads?

    /* Java thread status for tools,
     * initialized to indicate thread 'not yet started'
     */

    private volatile int threadStatus = 0;
0 Answers
Related