What is the fastest way to assign a variable in a class that implements Runnable?
<p>I have a class A that has a class B object. Class B has a boolean variable bool that the A instance keeps updating (off events). The B object b implements Runnable.</p>

<pre><code>class A{
  private B b;
}

class B implements Runnable{
  private boolean bool;

  run(){
    while(true){
      if(bool){//do something}
    }
  }
}
</code></pre>

<p>I assume that the boolean bool is actually on a’s thread because it is initialized when a calls B’s constructor, and the b thread does not begin until start is called on the b instance, and start is not called until after bool has been initialized. </p>

<p>If this is the case then the b thread must keep its own copy of bool. If this is the case, what is the fastest way of altering bool from a such that the b thread will see it; making bool volatile, or is there some way to assign directly to b’s copy?</p>

<p>Please forget about the loop, it is for GLES20. What I need to know is whether b has its copy of bool, and what is the fastest way for an event thread to continuously update a boolean on the GL thread.</p>
