src/exercises/o5_mutualExclusion/solution/problem3/v2_concurrent/Main_Choreograpy_MultiTokenWithAtomicMarkableReferences.java
public V take() throws InterruptedException
    {
      V value = null;
      do
      {
        if( Thread.currentThread().isInterrupted() )
        {
          throw new InterruptedException();
        }
        
        value = buffer.getReference();
      }while( !buffer.compareAndSet(value, null, true, false) );
      
      return value;
    }
// the value can also be null
the value can also be null
the value can also be null
public V take() throws InterruptedException
    {
      V value = null;
      do
      {
        if( Thread.currentThread().isInterrupted() )
        {
          throw new InterruptedException();
        }
        value = buffer.getReference();
      }while( !buffer.compareAndSet(value, null, true, false) );
      return value;
    }
public V take ( ) throws InterruptedException { V value = null ; do { if ( Thread . currentThread ( ) . isInterrupted ( ) ) { throw new InterruptedException ( ) ; } value = buffer . getReference ( ) ; } while ( ! buffer . compareAndSet ( value , null , true , false ) ) ; return value ; }
the value can also be null
the value can also be null